├── .editorconfig ├── .github └── FUNDING.yml ├── .gitignore ├── .gitmodules ├── .globalconfig ├── .travis.yml ├── KeraLua.Android.sln ├── KeraLua.Mac.sln ├── KeraLua.Symbol.nuspec ├── KeraLua.UWP.sln ├── KeraLua.net8.0.sln ├── KeraLua.net9.0-android.sln ├── KeraLua.netstandard.sln ├── KeraLua.nuspec ├── KeraLua.png ├── KeraLua.sln ├── LICENSE ├── NLua.snk ├── README.md ├── build ├── Android │ ├── KeraLua.Android.csproj │ └── KeraLua.net9.0-android.csproj ├── TVOS │ ├── ApiDefinition.cs │ ├── KeraLua.TVOS.csproj │ ├── KeraLua.net9.0-tvos.csproj │ └── Structs.cs ├── iOS │ ├── ApiDefinition.cs │ ├── KeraLua.XamariniOS.csproj │ ├── KeraLua.net9.0-ios.csproj │ ├── KeraLua.net9.0-maccatalyst.csproj │ └── Structs.cs ├── macOS │ ├── ApiDefinition.cs │ ├── KeraLua.XamarinMac.csproj │ ├── KeraLua.net9.0-macos.csproj │ └── Structs.cs ├── net46 │ └── KeraLua.csproj ├── net8.0 │ └── KeraLua.net8.0.csproj ├── netstandard2.0 │ └── KeraLua.netstandard2.0.csproj ├── targets │ ├── BuildLua.Android.targets │ ├── BuildLua.Common.props │ ├── BuildLua.Linux.targets │ ├── BuildLua.MacCatalyst.targets │ ├── BuildLua.OSX.targets │ ├── BuildLua.TVOS.targets │ ├── BuildLua.WatchOS.targets │ ├── BuildLua.Windows.targets │ ├── BuildLua.iOS.targets │ ├── KeraLua.Sign.targets │ └── KeraLua.targets └── uap10.0 │ └── KeraLua.UWP.csproj ├── devops ├── BuildFunctions.ps1 ├── Package.ps1 ├── PreBuild.ps1 ├── Publish.ps1 └── azure-devops.yml ├── src ├── .editorconfig ├── DelegateExtensions.cs ├── Delegates.cs ├── KeraLua.Core.projitems ├── KeraLua.Shared.shproj ├── Lua.cs ├── LuaCompare.cs ├── LuaDebug.cs ├── LuaGC.cs ├── LuaHookEvent.cs ├── LuaHookMask.cs ├── LuaOperation.cs ├── LuaRegister.cs ├── LuaRegistry.cs ├── LuaStatus.cs ├── LuaType.cs ├── Names.txt ├── NativeMethods.cs └── Properties │ └── AssemblyInfo.cs └── tests ├── LuaTests ├── core │ ├── bisect.lua │ ├── cf.lua │ ├── factorial.lua │ ├── fib.lua │ ├── fibfor.lua │ ├── life.lua │ ├── printf.lua │ ├── sieve.lua │ └── sort.lua └── scripts │ ├── foo.lua │ ├── main.lua │ └── module1.lua ├── Properties └── AssemblyInfo.cs ├── Tests ├── Core.cs └── Interop.cs └── build ├── net46 └── KeraLuaTest.csproj └── net9.0 └── KeraLuaTest.net9.0.csproj /.editorconfig: -------------------------------------------------------------------------------- 1 | ############################### 2 | # Core EditorConfig Options # 3 | ############################### 4 | 5 | root = true 6 | 7 | # All files 8 | [*] 9 | indent_style = space 10 | 11 | # Code files 12 | [*.{cs,csx,vb,vbx}] 13 | indent_size = 4 14 | insert_final_newline = true 15 | charset = utf-8-bom 16 | keep_blank_lines_in_code = 2 17 | trim_trailing_whitespace = true 18 | 19 | ############################### 20 | # .NET Coding Conventions # 21 | ############################### 22 | 23 | [*.{cs,vb}] 24 | # Organize usings 25 | dotnet_sort_system_directives_first = true 26 | dotnet_separate_import_directive_groups = true 27 | dotnet_diagnostic.IDE0005_gen.severity = error 28 | 29 | # this. preferences 30 | dotnet_style_qualification_for_field = false:none 31 | dotnet_style_qualification_for_property = false:none 32 | dotnet_style_qualification_for_method = false:none 33 | dotnet_style_qualification_for_event = false:none 34 | 35 | # Language keywords vs BCL types preferences 36 | dotnet_style_predefined_type_for_locals_parameters_members = true:error 37 | dotnet_style_predefined_type_for_member_access = true:none 38 | 39 | # Parentheses preferences 40 | dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent 41 | dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent 42 | dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent 43 | dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent 44 | 45 | # Modifier preferences 46 | dotnet_style_require_accessibility_modifiers = for_non_interface_members:error 47 | dotnet_style_readonly_field = true:error 48 | 49 | # Expression-level preferences 50 | dotnet_style_object_initializer = true:suggestion 51 | dotnet_style_collection_initializer = true:suggestion 52 | dotnet_style_explicit_tuple_names = true:suggestion 53 | dotnet_style_null_propagation = true:suggestion 54 | dotnet_style_coalesce_expression = true:suggestion 55 | dotnet_style_prefer_is_null_check_over_reference_equality_method = false:error 56 | dotnet_style_prefer_inferred_tuple_names = true:suggestion 57 | dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion 58 | dotnet_style_prefer_auto_properties = true:suggestion 59 | dotnet_style_prefer_conditional_expression_over_assignment = false:suggestion 60 | dotnet_style_prefer_conditional_expression_over_return = false:suggestion 61 | 62 | dotnet_style_prefer_simplified_boolean_expressions = true 63 | 64 | ############################### 65 | # C# Code Style Rules # 66 | ############################### 67 | 68 | # IDE0032: Use auto property 69 | dotnet_diagnostic.IDE0032.severity = suggestion 70 | dotnet_diagnostic.CA1823.severity=error 71 | 72 | # IDE0130: Namespace does not match folder structure 73 | dotnet_diagnostic.IDE0130.severity = none 74 | 75 | dotnet_diagnostic.IDE0180.severity = none 76 | 77 | [*.cs] 78 | 79 | 80 | # var preferences 81 | csharp_style_var_for_built_in_types = false:error 82 | csharp_style_var_when_type_is_apparent = true:none 83 | csharp_style_var_elsewhere = false:error 84 | 85 | # Expression-bodied members 86 | csharp_style_expression_bodied_methods = false:none 87 | csharp_style_expression_bodied_constructors = false:none 88 | csharp_style_expression_bodied_operators = false:none 89 | csharp_style_expression_bodied_properties = true:none 90 | csharp_style_expression_bodied_indexers = true:none 91 | csharp_style_expression_bodied_accessors = true:none 92 | 93 | # Pattern-matching preferences 94 | csharp_style_pattern_matching_over_is_with_cast_check = false:error 95 | csharp_style_pattern_matching_over_as_with_null_check = false:error 96 | 97 | # Null-checking preferences 98 | csharp_style_throw_expression = false:error 99 | csharp_style_conditional_delegate_call = true:suggestion 100 | 101 | # Modifier preferences 102 | csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:error 103 | 104 | # Expression-level preferences 105 | csharp_prefer_braces = true:none 106 | csharp_style_deconstructed_variable_declaration = true:suggestion 107 | csharp_prefer_simple_default_expression = true:suggestion 108 | csharp_style_pattern_local_over_anonymous_function = false:error 109 | csharp_style_inlined_variable_declaration = false:suggestion 110 | 111 | ############################### 112 | # C# Formatting Rules # 113 | ############################### 114 | 115 | # New line preferences 116 | csharp_new_line_before_open_brace = all 117 | csharp_new_line_before_else = true 118 | csharp_new_line_before_catch = true 119 | csharp_new_line_before_finally = true 120 | csharp_new_line_before_members_in_object_initializers = true 121 | csharp_new_line_before_members_in_anonymous_types = true 122 | csharp_new_line_between_query_expression_clauses = true 123 | 124 | # Indentation preferences 125 | csharp_indent_case_contents = true 126 | csharp_indent_switch_labels = true 127 | csharp_indent_labels = flush_left 128 | 129 | # Space preferences 130 | csharp_space_after_cast = false 131 | csharp_space_after_keywords_in_control_flow_statements = true 132 | csharp_space_between_method_call_parameter_list_parentheses = false 133 | csharp_space_between_method_declaration_parameter_list_parentheses = false 134 | csharp_space_between_parentheses = false 135 | csharp_space_before_colon_in_inheritance_clause = true 136 | csharp_space_after_colon_in_inheritance_clause = true 137 | csharp_space_around_binary_operators = before_and_after 138 | csharp_space_between_method_declaration_empty_parameter_list_parentheses = false 139 | csharp_space_between_method_call_name_and_opening_parenthesis = false 140 | csharp_space_between_method_call_empty_parameter_list_parentheses = false 141 | 142 | # Wrapping preferences 143 | csharp_preserve_single_line_statements = false 144 | csharp_preserve_single_line_blocks = true 145 | 146 | # Using 147 | 148 | csharp_using_directive_placement = outside_namespace 149 | 150 | # Wrapping options 151 | csharp_preserve_single_line_statements = false 152 | csharp_preserve_single_line_blocks = true 153 | 154 | # .NET naming conventions 155 | 156 | # See https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-naming-conventions?view=vs-2019 157 | 158 | # Style: camel case style 159 | dotnet_naming_style.camel_case.capitalization = camel_case 160 | 161 | # Style: pascal case style 162 | dotnet_naming_style.pascal_case.capitalization = pascal_case 163 | 164 | 165 | # Symbols: fields 166 | dotnet_naming_symbols.any_fields.applicable_kinds = field 167 | dotnet_naming_symbols.any_fields.applicable_accessibilities = * 168 | 169 | # Rule: private fields, properties, events must not be capitalized 170 | 171 | dotnet_naming_rule.private_fields_properties_events_must_not_be_capitalized.style = camel_case 172 | dotnet_naming_rule.private_fields_properties_events_must_not_be_capitalized.symbols = any_fields 173 | dotnet_naming_rule.private_fields_properties_events_must_not_be_capitalized.severity = error 174 | 175 | # Symbols: locals and parameters 176 | dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter,local 177 | 178 | # Rule: locals and parameters must be camel-case 179 | dotnet_naming_rule.locals_and_parameters_must_not_be_capitalized.style = camel_case 180 | dotnet_naming_rule.locals_and_parameters_must_not_be_capitalized.symbols = locals_and_parameters 181 | dotnet_naming_rule.locals_and_parameters_must_not_be_capitalized.severity = error 182 | 183 | # Symbols: const fields 184 | dotnet_naming_symbols.const_fields.applicable_kinds = field 185 | dotnet_naming_symbols.const_fields.required_modifiers = const 186 | 187 | # Rule: const fields must be capitalized 188 | dotnet_naming_rule.const_fields_must_be_capitalized.style = pascal_case 189 | dotnet_naming_rule.const_fields_must_be_capitalized.symbols = const_fields 190 | dotnet_naming_rule.const_fields_must_be_capitalized.severity = error 191 | 192 | # Symbols: static readonly fields 193 | dotnet_naming_symbols.static_readonly_fields.applicable_kinds = field 194 | dotnet_naming_symbols.static_readonly_fields.required_modifiers = static,readonly 195 | 196 | # Rule: static readonly fields must be capitalized 197 | dotnet_naming_rule.static_readonly_fields_must_be_capitalized.style = pascal_case 198 | dotnet_naming_rule.static_readonly_fields_must_be_capitalized.symbols = static_readonly_fields 199 | dotnet_naming_rule.static_readonly_fields_must_be_capitalized.severity = error 200 | 201 | 202 | # Symbols: interfaces 203 | dotnet_naming_symbols.interfaces.applicable_kinds = interface 204 | 205 | # Style: must be pascal case and begin with "I" 206 | dotnet_naming_style.must_begin_with_i.capitalization = pascal_case 207 | dotnet_naming_style.must_begin_with_i.required_prefix = I 208 | 209 | # Rule: interfaces must begin with "I" 210 | dotnet_naming_rule.interfaces_must_begin_with_i.style = must_begin_with_i 211 | dotnet_naming_rule.interfaces_must_begin_with_i.symbols = interfaces 212 | dotnet_naming_rule.interfaces_must_begin_with_i.severity = error 213 | 214 | # Symbols: namespaces, methods, delegates, classes, structs, interfaces, enums, local functions 215 | dotnet_naming_symbols.types_and_methods.applicable_kinds = property,event,namespace,class,struct,interface,enum,method,delegate,local_function 216 | dotnet_naming_symbols.types_and_methods.applicable_accessibilities = * 217 | 218 | # Rule: namespaces, methods, delegates, classes, structs, interfaces, enums, local functions must be capitalized 219 | dotnet_naming_rule.types_and_methods_must_be_capitalized.style = pascal_case 220 | dotnet_naming_rule.types_and_methods_must_be_capitalized.symbols = types_and_methods 221 | dotnet_naming_rule.types_and_methods_must_be_capitalized.severity = error 222 | 223 | # Symbols: type parameters 224 | dotnet_naming_symbols.type_parameters.applicable_kinds = type_parameter 225 | 226 | # Style: must be Pascal case and begin with a "T" 227 | dotnet_naming_style.must_begin_with_t.capitalization = pascal_case 228 | dotnet_naming_style.must_begin_with_t.required_prefix = T 229 | 230 | # Rule: type parameters must be pascal case and begin with a "T" 231 | dotnet_naming_rule.type_parameters_must_begin_with_t.style = must_begin_with_t 232 | dotnet_naming_rule.type_parameters_must_begin_with_t.symbols = type_parameters 233 | dotnet_naming_rule.type_parameters_must_begin_with_t.severity = error 234 | 235 | 236 | # Default severity for analyzer diagnostics with category 'Style' 237 | dotnet_analyzer_diagnostic.category-Style.severity = error 238 | dotnet_analyzer_diagnostic.category-performance.severity = error 239 | 240 | 241 | dotnet_diagnostic.IDE0004.severity = error 242 | dotnet_diagnostic.IDE0035.severity = error 243 | dotnet_diagnostic.IDE0051.severity = error 244 | dotnet_diagnostic.IDE0052.severity = error 245 | dotnet_diagnostic.IDE0058.severity = error 246 | dotnet_diagnostic.IDE0060.severity = error 247 | dotnet_diagnostic.IDE0079.severity = none 248 | dotnet_diagnostic.IDE0080.severity = error 249 | dotnet_diagnostic.IDE0083.severity = none 250 | dotnet_diagnostic.IDE0100.severity = error 251 | dotnet_diagnostic.IDE0110.severity = error 252 | dotnet_diagnostic.IDE0140.severity = error 253 | dotnet_diagnostic.IDE1006.severity = error 254 | 255 | # CA1012: Abstract types should not have public constructors 256 | dotnet_diagnostic.CA1012.severity = error 257 | dotnet_diagnostic.CA1822.severity = error 258 | 259 | 260 | # IDE0005: Using directive is unnecessary. 261 | dotnet_diagnostic.IDE0005.severity = error 262 | 263 | # IDE0007: Use implicit type 264 | dotnet_diagnostic.IDE0007.severity = error 265 | 266 | # IDE0078: Use pattern matching 267 | csharp_style_prefer_pattern_matching = false 268 | 269 | # IDE0051: Remove unused private members 270 | dotnet_diagnostic.IDE0051.severity = error 271 | 272 | # IDE0052: Remove unread private members 273 | dotnet_diagnostic.IDE0052.severity = error 274 | 275 | # IDE0001: Simplify Names 276 | dotnet_diagnostic.IDE0001.severity = error 277 | 278 | # IDE0066: Convert switch statement to expression 279 | csharp_style_prefer_switch_expression = false 280 | 281 | # CA2211: Non-constant fields should not be visible 282 | dotnet_diagnostic.CA2211.severity = error 283 | 284 | # Default severity for all analyzer diagnostics 285 | dotnet_analyzer_diagnostic.severity = error 286 | 287 | # Default severity for analyzer diagnostics with category 'Potential Code Quality Issues' 288 | dotnet_analyzer_diagnostic.category-Potential Code Quality Issues.severity = error 289 | dotnet_analyzer_diagnostic.category-Design.severity = error 290 | dotnet_analyzer_diagnostic.category-Maintainability.severity = error 291 | dotnet_analyzer_diagnostic.category-Performance.severity = error 292 | dotnet_analyzer_diagnostic.category-Security.severity = error 293 | dotnet_analyzer_diagnostic.category-Style.severity = error; 294 | dotnet_analyzer_diagnostic.category-Usage.severity = error; 295 | 296 | dotnet_code_quality.api_surface = public, internal, private 297 | dotnet_code_quality.CA1002.api_surface = public 298 | 299 | dotnet_code_quality.severity = error 300 | dotnet_diagnostic.severity = error 301 | dotnet_code_quality 302 | # RECS0145: Removes 'private' modifiers that are not required 303 | dotnet_diagnostic.RECS0145.severity = none 304 | 305 | # RECS0129: Removes 'internal' modifiers that are not required 306 | dotnet_diagnostic.RECS0129.severity = none 307 | 308 | # RECS0091: Use 'var' keyword when possible 309 | dotnet_diagnostic.RECS0091.severity = none 310 | 311 | # RECS0008: 'sealed' modifier is redundant in sealed classes 312 | dotnet_diagnostic.RECS0008.severity = none 313 | 314 | # RECS0083: Shows NotImplementedException throws in the quick task bar 315 | dotnet_diagnostic.RECS0083.severity = none 316 | 317 | # RECS0074: Redundant empty 'default' switch branch 318 | dotnet_diagnostic.RECS0074.severity = none 319 | 320 | # RECS0070: Redundant explicit argument name specification 321 | dotnet_diagnostic.RECS0070.severity = none 322 | 323 | # CA1708: Identifiers should differ by more than case 324 | dotnet_diagnostic.CA1708.severity = none 325 | 326 | # IDE0002: Simplify Member Access 327 | dotnet_diagnostic.IDE0002.severity = error 328 | 329 | # IDE0055: Fix formatting 330 | dotnet_diagnostic.IDE0055.severity = error 331 | 332 | # IDE0063: Use simple 'using' statement 333 | dotnet_diagnostic.IDE0063.severity = none 334 | 335 | # IDE0039: Use local function 336 | csharp_style_prefer_local_over_anonymous_function = false:error 337 | 338 | # IDE0057: Use range operator 339 | csharp_style_prefer_range_operator = false:error 340 | 341 | # IDE0056: Use index operator 342 | csharp_style_prefer_index_operator = false:error 343 | 344 | # IDE0090: Use 'new(...)' 345 | csharp_style_implicit_object_creation_when_type_is_apparent = false:error 346 | 347 | [*.vb] 348 | # Modifier preferences 349 | visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:suggestion 350 | 351 | 352 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | 2 | # These are supported funding model platforms 3 | 4 | github: viniciusjarina # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 5 | custom: https://www.paypal.me/viniciusjarina 6 | 7 | # open_collective: # Replace with a single Open Collective username 8 | # ko_fi: # Replace with a single Ko-fi username 9 | # tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 10 | # community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 11 | # liberapay: # Replace with a single Liberapay username 12 | # issuehunt: # Replace with a single IssueHunt username 13 | # otechie: # Replace with a single Otechie username 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Build Folders (you can keep bin if you'd like, to store dlls and pdbs) 2 | [Bb]in/ 3 | [Oo]bj/ 4 | 5 | # mstest test results 6 | TestResults 7 | 8 | ## Ignore Visual Studio temporary files, build results, and 9 | ## files generated by popular Visual Studio add-ons. 10 | 11 | # User-specific files 12 | *.suo 13 | *.user 14 | *.sln.docstates 15 | 16 | # Build results 17 | [Dd]ebug/ 18 | [Rr]elease/ 19 | x64/ 20 | *_i.c 21 | *_p.c 22 | *.ilk 23 | *.meta 24 | *.obj 25 | *.pch 26 | *.pdb 27 | *.pgc 28 | *.pgd 29 | *.rsp 30 | *.sbr 31 | *.tlb 32 | *.tli 33 | *.tlh 34 | *.tmp 35 | *.log 36 | *.vspscc 37 | *.vssscc 38 | .builds 39 | 40 | # Visual C++ cache files 41 | ipch/ 42 | *.aps 43 | *.ncb 44 | *.opensdf 45 | *.sdf 46 | 47 | # Visual Studio profiler 48 | *.psess 49 | *.vsp 50 | *.vspx 51 | 52 | # Guidance Automation Toolkit 53 | *.gpState 54 | 55 | # ReSharper is a .NET coding add-in 56 | _ReSharper* 57 | 58 | # NCrunch 59 | *.ncrunch* 60 | .*crunch*.local.xml 61 | 62 | # Installshield output folder 63 | [Ee]xpress 64 | 65 | # DocProject is a documentation generator add-in 66 | DocProject/buildhelp/ 67 | DocProject/Help/*.HxT 68 | DocProject/Help/*.HxC 69 | DocProject/Help/*.hhc 70 | DocProject/Help/*.hhk 71 | DocProject/Help/*.hhp 72 | DocProject/Help/Html2 73 | DocProject/Help/html 74 | 75 | # Click-Once directory 76 | publish 77 | 78 | # Publish Web Output 79 | *.Publish.xml 80 | 81 | 82 | # Windows Azure Build Output 83 | csx 84 | *.build.csdef 85 | 86 | # Windows Store app package directory 87 | AppPackages/ 88 | 89 | # Others 90 | [Bb]in 91 | [Oo]bj 92 | sql 93 | TestResults 94 | [Tt]est[Rr]esult* 95 | *.Cache 96 | ClientBin 97 | [Ss]tyle[Cc]op.* 98 | ~$* 99 | *.dbmdl 100 | Generated_Code #added for RIA/Silverlight projects 101 | 102 | # Backup & report files from converting an old project file to a newer 103 | # Visual Studio version. Backup files are not needed, because we have git ;-) 104 | _UpgradeReport_Files/ 105 | Backup*/ 106 | UpgradeLog*.XML 107 | 108 | # http://www.gnu.org/software/automake 109 | 110 | Makefile 111 | Makefile.in 112 | 113 | # http://www.gnu.org/software/autoconf 114 | 115 | /autom4te.cache 116 | /aclocal.m4 117 | /compile 118 | /configure 119 | /depcomp 120 | /install-sh 121 | /missing 122 | /config.status 123 | .vs/ 124 | UpgradeLog*.htm 125 | runtimes/ 126 | Result.xml 127 | .DS_Store 128 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "external/lua"] 2 | path = external/lua 3 | url = https://github.com/NLua/lua.git 4 | -------------------------------------------------------------------------------- /.globalconfig: -------------------------------------------------------------------------------- 1 | # NOTE: Requires **VS2019 16.7** or later 2 | 3 | # 'Design' Rules from '5.0' release with 'All' analysis mode 4 | # Description: 'Design' Rules with enabled-by-default state from '5.0' release with 'All' analysis mode. Rules that are first released in a version later than '5.0' are disabled. 5 | 6 | is_global = true 7 | 8 | global_level = -1 9 | 10 | dotnet_code_quality.CA1012.api_surface = private, internal 11 | 12 | # CA1000: Do not declare static members on generic types 13 | dotnet_diagnostic.CA1000.severity = warning 14 | 15 | # CA1001: Types that own disposable fields should be disposable 16 | dotnet_diagnostic.CA1001.severity = suggestion 17 | 18 | # CA1002: Do not expose generic lists 19 | dotnet_diagnostic.CA1002.severity = warning 20 | 21 | # CA1003: Use generic event handler instances 22 | dotnet_diagnostic.CA1003.severity = warning 23 | 24 | # CA1008: Enums should have zero value 25 | dotnet_diagnostic.CA1008.severity = warning 26 | 27 | # CA1010: Generic interface should also be implemented 28 | dotnet_diagnostic.CA1010.severity = warning 29 | 30 | # CA1012: Abstract types should not have public constructors 31 | dotnet_diagnostic.CA1012.severity = error 32 | 33 | # CA1014: Mark assemblies with CLSCompliant 34 | dotnet_diagnostic.CA1014.severity = suggestion 35 | 36 | # CA1016: Mark assemblies with assembly version 37 | dotnet_diagnostic.CA1016.severity = warning 38 | 39 | # CA1018: Mark attributes with AttributeUsageAttribute 40 | dotnet_diagnostic.CA1018.severity = warning 41 | 42 | # CA1019: Define accessors for attribute arguments 43 | dotnet_diagnostic.CA1019.severity = warning 44 | 45 | # CA1024: Use properties where appropriate 46 | dotnet_diagnostic.CA1024.severity = warning 47 | 48 | # CA1027: Mark enums with FlagsAttribute 49 | dotnet_diagnostic.CA1027.severity = warning 50 | 51 | # CA1028: Enum Storage should be Int32 52 | dotnet_diagnostic.CA1028.severity = warning 53 | 54 | # CA1030: Use events where appropriate 55 | dotnet_diagnostic.CA1030.severity = warning 56 | 57 | # CA1031: Do not catch general exception types 58 | dotnet_diagnostic.CA1031.severity = warning 59 | 60 | # CA1032: Implement standard exception constructors 61 | dotnet_diagnostic.CA1032.severity = warning 62 | 63 | # CA1033: Interface methods should be callable by child types 64 | dotnet_diagnostic.CA1033.severity = warning 65 | 66 | # CA1034: Nested types should not be visible 67 | dotnet_diagnostic.CA1034.severity = warning 68 | 69 | # CA1036: Override methods on comparable types 70 | dotnet_diagnostic.CA1036.severity = warning 71 | 72 | # CA1040: Avoid empty interfaces 73 | dotnet_diagnostic.CA1040.severity = warning 74 | 75 | # CA1041: Provide ObsoleteAttribute message 76 | dotnet_diagnostic.CA1041.severity = warning 77 | 78 | # CA1043: Use Integral Or String Argument For Indexers 79 | dotnet_diagnostic.CA1043.severity = warning 80 | 81 | # CA1044: Properties should not be write only 82 | dotnet_diagnostic.CA1044.severity = warning 83 | 84 | # CA1046: Do not overload equality operator on reference types 85 | dotnet_diagnostic.CA1046.severity = warning 86 | 87 | # CA1047: Do not declare protected member in sealed type 88 | dotnet_diagnostic.CA1047.severity = warning 89 | 90 | # CA1050: Declare types in namespaces 91 | dotnet_diagnostic.CA1050.severity = warning 92 | 93 | # CA1051: Do not declare visible instance fields 94 | dotnet_diagnostic.CA1051.severity = warning 95 | 96 | # CA1052: Static holder types should be Static or NotInheritable 97 | dotnet_diagnostic.CA1052.severity = warning 98 | 99 | # CA1054: URI-like parameters should not be strings 100 | dotnet_diagnostic.CA1054.severity = warning 101 | 102 | # CA1055: URI-like return values should not be strings 103 | dotnet_diagnostic.CA1055.severity = warning 104 | 105 | # CA1056: URI-like properties should not be strings 106 | dotnet_diagnostic.CA1056.severity = warning 107 | 108 | # CA1058: Types should not extend certain base types 109 | dotnet_diagnostic.CA1058.severity = warning 110 | 111 | # CA1061: Do not hide base class methods 112 | dotnet_diagnostic.CA1061.severity = warning 113 | 114 | # CA1062: Validate arguments of public methods 115 | dotnet_diagnostic.CA1062.severity = warning 116 | 117 | # CA1063: Implement IDisposable Correctly 118 | dotnet_diagnostic.CA1063.severity = warning 119 | 120 | # CA1064: Exceptions should be public 121 | dotnet_diagnostic.CA1064.severity = warning 122 | 123 | # CA1065: Do not raise exceptions in unexpected locations 124 | dotnet_diagnostic.CA1065.severity = warning 125 | 126 | # CA1066: Implement IEquatable when overriding Object.Equals 127 | dotnet_diagnostic.CA1066.severity = warning 128 | 129 | # CA1067: Override Object.Equals(object) when implementing IEquatable 130 | dotnet_diagnostic.CA1067.severity = warning 131 | 132 | # CA1068: CancellationToken parameters must come last 133 | dotnet_diagnostic.CA1068.severity = warning 134 | 135 | # CA1069: Enums values should not be duplicated 136 | dotnet_diagnostic.CA1069.severity = warning 137 | 138 | # CA1070: Do not declare event fields as virtual 139 | dotnet_diagnostic.CA1070.severity = warning -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # 2 | # KeraLua Travis-CI Hook 3 | # 4 | 5 | language: csharp 6 | 7 | dotnet: 3.1 8 | 9 | before_install: 10 | - export PATH=/opt/mono/bin:$PATH 11 | 12 | install: 13 | - sudo apt-get install mono-devel nunit nuget 14 | 15 | script: 16 | - nuget restore KeraLua.sln 17 | - msbuild KeraLua.sln /p:Configuration=Release /t:Restore 18 | - msbuild KeraLua.sln /p:Configuration=Release 19 | - dotnet test ./tests/build/net46/bin/Release/KeraLuaTest.dll 20 | 21 | # Execute additional tests or commands 22 | #after_script: 23 | # - [run additional test commans] 24 | 25 | # Only watch the main branch 26 | branches: 27 | only: 28 | - main 29 | 30 | # Notify if needed 31 | notifications: 32 | recipients: 33 | - viniciusjarina@gmail.com 34 | email: 35 | on_success: change 36 | on_failure: always 37 | -------------------------------------------------------------------------------- /KeraLua.Android.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26730.12 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "KeraLua", "KeraLua", "{4A43DAAC-F9FF-4EB1-BFBD-FB4655CCE1F7}" 7 | EndProject 8 | Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "KeraLua.Shared", "src\KeraLua.Shared.shproj", "{BD205AD6-760E-48F3-BAB2-21447396BD17}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeraLua.Android", "build\Android\KeraLua.Android.csproj", "{4B766E88-5872-4437-882D-C887A3C0CDF7}" 11 | EndProject 12 | Global 13 | GlobalSection(SharedMSBuildProjectFiles) = preSolution 14 | src\KeraLua.Core.projitems*{4b766e88-5872-4437-882d-c887a3c0cdf7}*SharedItemsImports = 4 15 | src\KeraLua.Core.projitems*{bd205ad6-760e-48f3-bab2-21447396bd17}*SharedItemsImports = 13 16 | EndGlobalSection 17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 18 | Debug|Any CPU = Debug|Any CPU 19 | Release|Any CPU = Release|Any CPU 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {4B766E88-5872-4437-882D-C887A3C0CDF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {4B766E88-5872-4437-882D-C887A3C0CDF7}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {4B766E88-5872-4437-882D-C887A3C0CDF7}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {4B766E88-5872-4437-882D-C887A3C0CDF7}.Release|Any CPU.Build.0 = Release|Any CPU 26 | EndGlobalSection 27 | GlobalSection(SolutionProperties) = preSolution 28 | HideSolutionNode = FALSE 29 | EndGlobalSection 30 | GlobalSection(NestedProjects) = preSolution 31 | {BD205AD6-760E-48F3-BAB2-21447396BD17} = {4A43DAAC-F9FF-4EB1-BFBD-FB4655CCE1F7} 32 | {4B766E88-5872-4437-882D-C887A3C0CDF7} = {4A43DAAC-F9FF-4EB1-BFBD-FB4655CCE1F7} 33 | EndGlobalSection 34 | GlobalSection(ExtensibilityGlobals) = postSolution 35 | SolutionGuid = {4720E610-698B-48DD-BBD7-03AC99E9BC90} 36 | EndGlobalSection 37 | EndGlobal 38 | -------------------------------------------------------------------------------- /KeraLua.Mac.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26730.12 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "KeraLua", "KeraLua", "{4A43DAAC-F9FF-4EB1-BFBD-FB4655CCE1F7}" 7 | EndProject 8 | Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "KeraLua.Shared", "src\KeraLua.Shared.shproj", "{BD205AD6-760E-48F3-BAB2-21447396BD17}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeraLua.TVOS", "build\TVOS\KeraLua.TVOS.csproj", "{9238F6AA-2D63-4804-99D1-C279871F5669}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeraLua.XamarinIOS", "build\iOS\KeraLua.XamarinIOS.csproj", "{8FAFDF62-E07E-487A-863C-74F308AE7BA6}" 13 | EndProject 14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeraLua.XamarinMac", "build\macOS\KeraLua.XamarinMac.csproj", "{4E863C20-43C3-43A0-9678-8583B9614277}" 15 | EndProject 16 | Global 17 | GlobalSection(SharedMSBuildProjectFiles) = preSolution 18 | src\KeraLua.Core.projitems*{4e863c20-43c3-43a0-9678-8583b9614277}*SharedItemsImports = 4 19 | src\KeraLua.Core.projitems*{8fafdf62-e07e-487a-863c-74f308ae7ba6}*SharedItemsImports = 4 20 | src\KeraLua.Core.projitems*{9238f6aa-2d63-4804-99d1-c279871f5669}*SharedItemsImports = 4 21 | src\KeraLua.Core.projitems*{bd205ad6-760e-48f3-bab2-21447396bd17}*SharedItemsImports = 13 22 | src\KeraLua.Core.projitems*{bf6a650f-aa7a-4a08-8ada-08d9e73e1238}*SharedItemsImports = 4 23 | EndGlobalSection 24 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 25 | Debug|Any CPU = Debug|Any CPU 26 | Release|Any CPU = Release|Any CPU 27 | EndGlobalSection 28 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 29 | {9238F6AA-2D63-4804-99D1-C279871F5669}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 30 | {9238F6AA-2D63-4804-99D1-C279871F5669}.Debug|Any CPU.Build.0 = Debug|Any CPU 31 | {9238F6AA-2D63-4804-99D1-C279871F5669}.Release|Any CPU.ActiveCfg = Release|Any CPU 32 | {9238F6AA-2D63-4804-99D1-C279871F5669}.Release|Any CPU.Build.0 = Release|Any CPU 33 | {8FAFDF62-E07E-487A-863C-74F308AE7BA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 34 | {8FAFDF62-E07E-487A-863C-74F308AE7BA6}.Debug|Any CPU.Build.0 = Debug|Any CPU 35 | {8FAFDF62-E07E-487A-863C-74F308AE7BA6}.Release|Any CPU.ActiveCfg = Release|Any CPU 36 | {8FAFDF62-E07E-487A-863C-74F308AE7BA6}.Release|Any CPU.Build.0 = Release|Any CPU 37 | {4E863C20-43C3-43A0-9678-8583B9614277}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 38 | {4E863C20-43C3-43A0-9678-8583B9614277}.Debug|Any CPU.Build.0 = Debug|Any CPU 39 | {4E863C20-43C3-43A0-9678-8583B9614277}.Release|Any CPU.ActiveCfg = Release|Any CPU 40 | {4E863C20-43C3-43A0-9678-8583B9614277}.Release|Any CPU.Build.0 = Release|Any CPU 41 | EndGlobalSection 42 | GlobalSection(SolutionProperties) = preSolution 43 | HideSolutionNode = FALSE 44 | EndGlobalSection 45 | GlobalSection(NestedProjects) = preSolution 46 | {BD205AD6-760E-48F3-BAB2-21447396BD17} = {4A43DAAC-F9FF-4EB1-BFBD-FB4655CCE1F7} 47 | {9238F6AA-2D63-4804-99D1-C279871F5669} = {4A43DAAC-F9FF-4EB1-BFBD-FB4655CCE1F7} 48 | {8FAFDF62-E07E-487A-863C-74F308AE7BA6} = {4A43DAAC-F9FF-4EB1-BFBD-FB4655CCE1F7} 49 | {4E863C20-43C3-43A0-9678-8583B9614277} = {4A43DAAC-F9FF-4EB1-BFBD-FB4655CCE1F7} 50 | EndGlobalSection 51 | GlobalSection(ExtensibilityGlobals) = postSolution 52 | SolutionGuid = {4720E610-698B-48DD-BBD7-03AC99E9BC90} 53 | EndGlobalSection 54 | EndGlobal 55 | -------------------------------------------------------------------------------- /KeraLua.Symbol.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | KeraLua 5 | 1.0.16 6 | NLua 7 | Vinicius Jarina 8 | https://github.com/nlua/KeraLua/blob/main/LICENSE 9 | https://github.com/nlua/KeraLua 10 | https://raw.githubusercontent.com/nlua/KeraLua/main/KeraLua.png 11 | false 12 | 13 | C# Native bindings of Lua 5.4 (compatible with iOS/Mac/Android/UWP/.NET) 14 | 15 | Release: 2bffe65 16 | Copyright © Vinicius Jarina 2025 17 | lua keralua 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /KeraLua.UWP.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29806.167 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "KeraLua", "KeraLua", "{4A43DAAC-F9FF-4EB1-BFBD-FB4655CCE1F7}" 7 | EndProject 8 | Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "KeraLua.Shared", "src\KeraLua.Shared.shproj", "{BD205AD6-760E-48F3-BAB2-21447396BD17}" 9 | EndProject 10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{B3EAA632-D2D7-4272-9DB9-11F46C99DAE9}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeraLua.UWP", "build\uap10.0\KeraLua.UWP.csproj", "{8E903752-A674-467B-AB4F-112206A46140}" 13 | EndProject 14 | Global 15 | GlobalSection(SharedMSBuildProjectFiles) = preSolution 16 | src\KeraLua.Core.projitems*{8e903752-a674-467b-ab4f-112206a46140}*SharedItemsImports = 4 17 | src\KeraLua.Core.projitems*{bd205ad6-760e-48f3-bab2-21447396bd17}*SharedItemsImports = 13 18 | EndGlobalSection 19 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 20 | Debug|Any CPU = Debug|Any CPU 21 | Release|Any CPU = Release|Any CPU 22 | EndGlobalSection 23 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 24 | {8E903752-A674-467B-AB4F-112206A46140}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {8E903752-A674-467B-AB4F-112206A46140}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {8E903752-A674-467B-AB4F-112206A46140}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {8E903752-A674-467B-AB4F-112206A46140}.Release|Any CPU.Build.0 = Release|Any CPU 28 | EndGlobalSection 29 | GlobalSection(SolutionProperties) = preSolution 30 | HideSolutionNode = FALSE 31 | EndGlobalSection 32 | GlobalSection(NestedProjects) = preSolution 33 | {BD205AD6-760E-48F3-BAB2-21447396BD17} = {4A43DAAC-F9FF-4EB1-BFBD-FB4655CCE1F7} 34 | {8E903752-A674-467B-AB4F-112206A46140} = {4A43DAAC-F9FF-4EB1-BFBD-FB4655CCE1F7} 35 | EndGlobalSection 36 | GlobalSection(ExtensibilityGlobals) = postSolution 37 | SolutionGuid = {4720E610-698B-48DD-BBD7-03AC99E9BC90} 38 | EndGlobalSection 39 | EndGlobal 40 | -------------------------------------------------------------------------------- /KeraLua.net8.0.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.31112.23 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "KeraLua", "KeraLua", "{4A43DAAC-F9FF-4EB1-BFBD-FB4655CCE1F7}" 7 | EndProject 8 | Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "KeraLua.Shared", "src\KeraLua.Shared.shproj", "{BD205AD6-760E-48F3-BAB2-21447396BD17}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "KeraLua.net8.0", "build\net8.0\KeraLua.net8.0.csproj", "{078D8C1B-0CD3-4500-9400-687609C1299C}" 11 | EndProject 12 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{2AF69FF8-83DC-4BBF-8C13-C034C23B0EBA}" 13 | EndProject 14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "KeraLuaTest.net9.0", "tests\build\net9.0\KeraLuaTest.net9.0.csproj", "{B915B26F-5B5B-441A-A9BF-565B67891F2F}" 15 | EndProject 16 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0BB3C48C-2EA8-4E26-BBB7-7B13BDE86841}" 17 | ProjectSection(SolutionItems) = preProject 18 | .editorconfig = .editorconfig 19 | EndProjectSection 20 | EndProject 21 | Global 22 | GlobalSection(SharedMSBuildProjectFiles) = preSolution 23 | src\KeraLua.Core.projitems*{078d8c1b-0cd3-4500-9400-687609c1299c}*SharedItemsImports = 5 24 | src\KeraLua.Core.projitems*{bd205ad6-760e-48f3-bab2-21447396bd17}*SharedItemsImports = 13 25 | EndGlobalSection 26 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 27 | Debug|Any CPU = Debug|Any CPU 28 | Release|Any CPU = Release|Any CPU 29 | EndGlobalSection 30 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 31 | {078D8C1B-0CD3-4500-9400-687609C1299C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 32 | {078D8C1B-0CD3-4500-9400-687609C1299C}.Debug|Any CPU.Build.0 = Debug|Any CPU 33 | {078D8C1B-0CD3-4500-9400-687609C1299C}.Release|Any CPU.ActiveCfg = Release|Any CPU 34 | {078D8C1B-0CD3-4500-9400-687609C1299C}.Release|Any CPU.Build.0 = Release|Any CPU 35 | {B915B26F-5B5B-441A-A9BF-565B67891F2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 36 | {B915B26F-5B5B-441A-A9BF-565B67891F2F}.Debug|Any CPU.Build.0 = Debug|Any CPU 37 | {B915B26F-5B5B-441A-A9BF-565B67891F2F}.Release|Any CPU.ActiveCfg = Release|Any CPU 38 | {B915B26F-5B5B-441A-A9BF-565B67891F2F}.Release|Any CPU.Build.0 = Release|Any CPU 39 | EndGlobalSection 40 | GlobalSection(SolutionProperties) = preSolution 41 | HideSolutionNode = FALSE 42 | EndGlobalSection 43 | GlobalSection(NestedProjects) = preSolution 44 | {BD205AD6-760E-48F3-BAB2-21447396BD17} = {4A43DAAC-F9FF-4EB1-BFBD-FB4655CCE1F7} 45 | {078D8C1B-0CD3-4500-9400-687609C1299C} = {4A43DAAC-F9FF-4EB1-BFBD-FB4655CCE1F7} 46 | {B915B26F-5B5B-441A-A9BF-565B67891F2F} = {2AF69FF8-83DC-4BBF-8C13-C034C23B0EBA} 47 | EndGlobalSection 48 | GlobalSection(ExtensibilityGlobals) = postSolution 49 | SolutionGuid = {4720E610-698B-48DD-BBD7-03AC99E9BC90} 50 | EndGlobalSection 51 | EndGlobal 52 | -------------------------------------------------------------------------------- /KeraLua.net9.0-android.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26730.12 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "KeraLua", "KeraLua", "{4A43DAAC-F9FF-4EB1-BFBD-FB4655CCE1F7}" 7 | EndProject 8 | Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "KeraLua.Shared", "src\KeraLua.Shared.shproj", "{BD205AD6-760E-48F3-BAB2-21447396BD17}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeraLua.net9.0-android", "build\Android\KeraLua.net9.0-android.csproj", "{E0576585-777B-42D2-8BC2-676FF5724940}" 11 | EndProject 12 | Global 13 | GlobalSection(SharedMSBuildProjectFiles) = preSolution 14 | src\KeraLua.Core.projitems*{4b766e88-5872-4437-882d-c887a3c0cdf7}*SharedItemsImports = 4 15 | src\KeraLua.Core.projitems*{bd205ad6-760e-48f3-bab2-21447396bd17}*SharedItemsImports = 13 16 | EndGlobalSection 17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 18 | Debug|Any CPU = Debug|Any CPU 19 | Release|Any CPU = Release|Any CPU 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {E0576585-777B-42D2-8BC2-676FF5724940}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {E0576585-777B-42D2-8BC2-676FF5724940}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {E0576585-777B-42D2-8BC2-676FF5724940}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {E0576585-777B-42D2-8BC2-676FF5724940}.Release|Any CPU.Build.0 = Release|Any CPU 26 | EndGlobalSection 27 | GlobalSection(SolutionProperties) = preSolution 28 | HideSolutionNode = FALSE 29 | EndGlobalSection 30 | GlobalSection(NestedProjects) = preSolution 31 | {BD205AD6-760E-48F3-BAB2-21447396BD17} = {4A43DAAC-F9FF-4EB1-BFBD-FB4655CCE1F7} 32 | {E0576585-777B-42D2-8BC2-676FF5724940} = {4A43DAAC-F9FF-4EB1-BFBD-FB4655CCE1F7} 33 | EndGlobalSection 34 | GlobalSection(ExtensibilityGlobals) = postSolution 35 | SolutionGuid = {4720E610-698B-48DD-BBD7-03AC99E9BC90} 36 | EndGlobalSection 37 | EndGlobal 38 | -------------------------------------------------------------------------------- /KeraLua.netstandard.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.31205.134 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "KeraLua", "KeraLua", "{4A43DAAC-F9FF-4EB1-BFBD-FB4655CCE1F7}" 7 | EndProject 8 | Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "KeraLua.Shared", "src\KeraLua.Shared.shproj", "{BD205AD6-760E-48F3-BAB2-21447396BD17}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "KeraLua.netstandard2.0", "build\netstandard2.0\KeraLua.netstandard2.0.csproj", "{23F44CC0-64E4-4E29-8A99-1A6DADB4BBB4}" 11 | EndProject 12 | Global 13 | GlobalSection(SharedMSBuildProjectFiles) = preSolution 14 | src\KeraLua.Core.projitems*{078d8c1b-0cd3-4500-9400-687609c1299c}*SharedItemsImports = 5 15 | src\KeraLua.Core.projitems*{23f44cc0-64e4-4e29-8a99-1a6dadb4bbb4}*SharedItemsImports = 5 16 | src\KeraLua.Core.projitems*{bd205ad6-760e-48f3-bab2-21447396bd17}*SharedItemsImports = 13 17 | EndGlobalSection 18 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 19 | Debug|Any CPU = Debug|Any CPU 20 | Release|Any CPU = Release|Any CPU 21 | EndGlobalSection 22 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 23 | {23F44CC0-64E4-4E29-8A99-1A6DADB4BBB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 24 | {23F44CC0-64E4-4E29-8A99-1A6DADB4BBB4}.Debug|Any CPU.Build.0 = Debug|Any CPU 25 | {23F44CC0-64E4-4E29-8A99-1A6DADB4BBB4}.Release|Any CPU.ActiveCfg = Release|Any CPU 26 | {23F44CC0-64E4-4E29-8A99-1A6DADB4BBB4}.Release|Any CPU.Build.0 = Release|Any CPU 27 | EndGlobalSection 28 | GlobalSection(SolutionProperties) = preSolution 29 | HideSolutionNode = FALSE 30 | EndGlobalSection 31 | GlobalSection(NestedProjects) = preSolution 32 | {BD205AD6-760E-48F3-BAB2-21447396BD17} = {4A43DAAC-F9FF-4EB1-BFBD-FB4655CCE1F7} 33 | EndGlobalSection 34 | GlobalSection(ExtensibilityGlobals) = postSolution 35 | SolutionGuid = {4720E610-698B-48DD-BBD7-03AC99E9BC90} 36 | EndGlobalSection 37 | EndGlobal 38 | -------------------------------------------------------------------------------- /KeraLua.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | KeraLua 5 | 1.0.16 6 | NLua 7 | Vinicius Jarina 8 | https://github.com/nlua/KeraLua/blob/main/LICENSE 9 | https://github.com/nlua/KeraLua 10 | https://raw.githubusercontent.com/nlua/KeraLua/main/KeraLua.png 11 | false 12 | 13 | C# Native bindings of Lua 5.4 (compatible with iOS/Mac/Android/.NET/UWP) 14 | 15 | Release: 2bffe65 16 | Copyright © Vinicius Jarina 2025 17 | lua keralua 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /KeraLua.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NLua/KeraLua/e9d2f63e11e47a5a73d9f15243547ca722cca0a4/KeraLua.png -------------------------------------------------------------------------------- /KeraLua.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26730.12 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "KeraLua", "KeraLua", "{4A43DAAC-F9FF-4EB1-BFBD-FB4655CCE1F7}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeraLua", "build\net46\KeraLua.csproj", "{C45805A8-6436-4738-BD9F-4632EEA63BBC}" 9 | EndProject 10 | Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "KeraLua.Shared", "src\KeraLua.Shared.shproj", "{BD205AD6-760E-48F3-BAB2-21447396BD17}" 11 | EndProject 12 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{B3EAA632-D2D7-4272-9DB9-11F46C99DAE9}" 13 | EndProject 14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeraLuaTest", "tests\build\net46\KeraLuaTest.csproj", "{20AE709C-FB97-48E3-89B0-A34A5C3DA1DB}" 15 | EndProject 16 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1E40364B-8DAF-44D1-B512-0F8A2CB3F2FA}" 17 | ProjectSection(SolutionItems) = preProject 18 | .editorconfig = .editorconfig 19 | EndProjectSection 20 | EndProject 21 | Global 22 | GlobalSection(SharedMSBuildProjectFiles) = preSolution 23 | src\KeraLua.Core.projitems*{bd205ad6-760e-48f3-bab2-21447396bd17}*SharedItemsImports = 13 24 | src\KeraLua.Core.projitems*{c45805a8-6436-4738-bd9f-4632eea63bbc}*SharedItemsImports = 4 25 | EndGlobalSection 26 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 27 | Debug|Any CPU = Debug|Any CPU 28 | Release|Any CPU = Release|Any CPU 29 | EndGlobalSection 30 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 31 | {C45805A8-6436-4738-BD9F-4632EEA63BBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 32 | {C45805A8-6436-4738-BD9F-4632EEA63BBC}.Debug|Any CPU.Build.0 = Debug|Any CPU 33 | {C45805A8-6436-4738-BD9F-4632EEA63BBC}.Release|Any CPU.ActiveCfg = Release|Any CPU 34 | {C45805A8-6436-4738-BD9F-4632EEA63BBC}.Release|Any CPU.Build.0 = Release|Any CPU 35 | {20AE709C-FB97-48E3-89B0-A34A5C3DA1DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 36 | {20AE709C-FB97-48E3-89B0-A34A5C3DA1DB}.Debug|Any CPU.Build.0 = Debug|Any CPU 37 | {20AE709C-FB97-48E3-89B0-A34A5C3DA1DB}.Release|Any CPU.ActiveCfg = Release|Any CPU 38 | {20AE709C-FB97-48E3-89B0-A34A5C3DA1DB}.Release|Any CPU.Build.0 = Release|Any CPU 39 | EndGlobalSection 40 | GlobalSection(SolutionProperties) = preSolution 41 | HideSolutionNode = FALSE 42 | EndGlobalSection 43 | GlobalSection(NestedProjects) = preSolution 44 | {C45805A8-6436-4738-BD9F-4632EEA63BBC} = {4A43DAAC-F9FF-4EB1-BFBD-FB4655CCE1F7} 45 | {BD205AD6-760E-48F3-BAB2-21447396BD17} = {4A43DAAC-F9FF-4EB1-BFBD-FB4655CCE1F7} 46 | {20AE709C-FB97-48E3-89B0-A34A5C3DA1DB} = {B3EAA632-D2D7-4272-9DB9-11F46C99DAE9} 47 | EndGlobalSection 48 | GlobalSection(ExtensibilityGlobals) = postSolution 49 | SolutionGuid = {4720E610-698B-48DD-BBD7-03AC99E9BC90} 50 | EndGlobalSection 51 | EndGlobal 52 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2019 Vinicius Jarina (viniciusjarina@gmail.com) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. -------------------------------------------------------------------------------- /NLua.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NLua/KeraLua/e9d2f63e11e47a5a73d9f15243547ca722cca0a4/NLua.snk -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 👋 Hello there! | 2 | ------------ | 3 | > 🔭 Thank you for checking out this project. 4 | > 5 | > 🍻 We've made the project Open Source and **MIT** license so everyone can enjoy it. 6 | > 7 | > 🛠 To deliver a project with quality we have to spent a lot of time working on it. 8 | > 9 | > ⭐️ If you liked the project please star it. 10 | > 11 | > 💕 We also appreaciate any **Sponsor** [ [Patreon](https://www.patreon.com/codefoco) | [PayPal](paypal.me/viniciusjarina) ] 12 | 13 | [![Logo](https://raw.githubusercontent.com/NLua/KeraLua/main/KeraLua.png)]() 14 | 15 | KeraLua 16 | ======= 17 | 18 | 19 | | NuGet | 20 | | ------| 21 | |[![nuget](https://badgen.net/nuget/v/KeraLua?icon=nuget)](https://www.nuget.org/packages/KeraLua)| 22 | 23 | | | Status | 24 | | :------ | :------: | 25 | |![linux](https://badgen.net/badge/icon/Ubuntu%20Linux%20x64?icon=travis&label&color=orange) | [![Linux](https://travis-ci.org/NLua/KeraLua.svg?branch=main)](https://travis-ci.org/NLua/KeraLua) | 26 | | ![win](https://badgen.net/badge/icon/Windows?icon=windows&label&color=blue) | [![Build status](https://ci.appveyor.com/api/projects/status/jkqcy9m9k35jwolx?svg=true)](https://ci.appveyor.com/project/viniciusjarina/keralua)| 27 | | ![mac](https://badgen.net/badge/icon/macOS,iOS,tvOS,watchOS?icon=apple&label&color=purple&list=1) | [![Build Status](https://dev.azure.com/codefoco/NuGets/_apis/build/status/KeraLua?branchName=main&jobName=Mac)](https://dev.azure.com/codefoco/NuGets/_build/latest?definitionId=64&branchName=main) | 28 | |![linux](https://badgen.net/badge/icon/Ubuntu%20Linux%20x64?icon=terminal&label&color=orange) | [![Build Status](https://dev.azure.com/codefoco/NuGets/_apis/build/status/KeraLua?branchName=main&jobName=Linux)](https://dev.azure.com/codefoco/NuGets/_build/latest?definitionId=64&branchName=main) | 29 | |![win](https://badgen.net/badge/icon/Windows,.NET%20Core?icon=windows&label&list=1) | [![Build Status](https://dev.azure.com/codefoco/NuGets/_apis/build/status/KeraLua?branchName=main&jobName=Windows)](https://dev.azure.com/codefoco/NuGets/_build/latest?definitionId=64&branchName=main) | 30 | 31 | 32 | C# Native bindings of Lua 5.4 (compatible with iOS/Mac/Android/UWP/.NET) 33 | 34 | Before build fetch the submodules: 35 | 36 | git submodule update --init --recursive 37 | 38 | Building 39 | --------- 40 | 41 | KeraLua uses several solution for different targets. (I know I could use SDK style project + multi-target, but neither VS and VS4Mac work very well with that, and the intelisense always get confused). 42 | So for Mac,iOS,tvOS use KeraLua.Mac.sln, Android KeraLua.Android.sln, .NET Core KeraLua.Core.sln and UWP KeraLua.UWP.sln 43 | 44 | To build old classic .NET 4.5 just use the KeraLua.sln. (I usually do my develoment on .NET 4.5 using VS4Mac + Mono on Mac, and .NET + VS on Windows, since this was the configuration which cause less issues to me.) 45 | 46 | 47 | nuget restore KeraLua.sln 48 | msbuild KeraLua.sln 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /build/Android/KeraLua.Android.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {4B766E88-5872-4437-882D-C887A3C0CDF7} 8 | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 9 | Library 10 | KeraLua.Android 11 | KeraLua 12 | v13.0 13 | Assets 14 | 15 | 16 | true 17 | full 18 | false 19 | ..\..\lib\Debug\MonoAndroid 20 | DEBUG;__MOBILE__;__ANDROID__ 21 | prompt 22 | 4 23 | None 24 | 25 | 26 | true 27 | 28 | 29 | true 30 | portable 31 | ..\..\lib\Release\MonoAndroid 32 | __MOBILE__;__ANDROID__ 33 | prompt 34 | 4 35 | true 36 | false 37 | 38 | 39 | true 40 | ..\..\lib\Release\MonoAndroid\KeraLua.xml 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | libs\arm64-v8a\liblua54.so 51 | 52 | 53 | libs\armeabi-v7a\liblua54.so 54 | 55 | 56 | libs\x86\liblua54.so 57 | 58 | 59 | libs\x86_64\liblua54.so 60 | 61 | 62 | 63 | 64 | all 65 | runtime; build; native; contentfiles; analyzers 66 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /build/Android/KeraLua.net9.0-android.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | Library 7 | KeraLua.Android 8 | KeraLua 9 | net9.0-android 10 | 28.0 11 | v13.0 12 | android-x86;android-x64;android-arm;android-arm64 13 | Assets 14 | 15 | 16 | true 17 | full 18 | false 19 | ..\..\lib\Debug 20 | DEBUG;__MOBILE__;__ANDROID__ 21 | prompt 22 | 4 23 | None 24 | 25 | 26 | true 27 | 28 | 29 | true 30 | portable 31 | ..\..\lib\Release 32 | __MOBILE__;__ANDROID__ 33 | prompt 34 | 4 35 | true 36 | false 37 | 38 | 39 | true 40 | ..\..\lib\Release\net9.0-android\KeraLua.xml 41 | 42 | 43 | 44 | 45 | 46 | libs\arm64-v8a\liblua54.so 47 | 48 | 49 | libs\armeabi-v7a\liblua54.so 50 | 51 | 52 | libs\x86\liblua54.so 53 | 54 | 55 | libs\x86_64\liblua54.so 56 | 57 | 58 | 59 | 60 | all 61 | runtime; build; native; contentfiles; analyzers 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /build/TVOS/ApiDefinition.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NLua/KeraLua/e9d2f63e11e47a5a73d9f15243547ca722cca0a4/build/TVOS/ApiDefinition.cs -------------------------------------------------------------------------------- /build/TVOS/KeraLua.TVOS.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {9238F6AA-2D63-4804-99D1-C279871F5669} 8 | {4A1ED743-3331-459B-915A-4B17C7B6DBB6};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 9 | Library 10 | KeraLua 11 | KeraLua 12 | Resources 13 | 14 | 15 | true 16 | full 17 | false 18 | ..\..\lib\Debug\xamarintvos 19 | DEBUG; 20 | prompt 21 | 4 22 | iPhone Developer 23 | true 24 | true 25 | true 26 | 16365 27 | false 28 | true 29 | true 30 | 31 | 32 | portable 33 | true 34 | ..\..\lib\Release\xamarintvos 35 | 36 | 37 | prompt 38 | 4 39 | iPhone Developer 40 | true 41 | SdkOnly 42 | true 43 | ..\..\lib\Release\xamarintvos\KeraLua.xml 44 | true 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | Framework 57 | 58 | 59 | 60 | 61 | all 62 | runtime; build; native; contentfiles; analyzers 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /build/TVOS/KeraLua.net9.0-tvos.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | Library 7 | KeraLua 8 | KeraLua 9 | net9.0-tvos 10 | Resources 11 | true 12 | 13 | 14 | true 15 | full 16 | false 17 | ..\..\lib\Debug 18 | DEBUG; 19 | prompt 20 | 4 21 | iPhone Developer 22 | true 23 | true 24 | true 25 | 16365 26 | false 27 | true 28 | true 29 | 30 | 31 | portable 32 | true 33 | ..\..\lib\Release 34 | 35 | 36 | prompt 37 | 4 38 | iPhone Developer 39 | true 40 | SdkOnly 41 | true 42 | ..\..\lib\Release\net9.0-tvos\KeraLua.xml 43 | true 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | Framework 52 | 53 | 54 | 55 | 56 | all 57 | runtime; build; native; contentfiles; analyzers 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /build/TVOS/Structs.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NLua/KeraLua/e9d2f63e11e47a5a73d9f15243547ca722cca0a4/build/TVOS/Structs.cs -------------------------------------------------------------------------------- /build/iOS/ApiDefinition.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NLua/KeraLua/e9d2f63e11e47a5a73d9f15243547ca722cca0a4/build/iOS/ApiDefinition.cs -------------------------------------------------------------------------------- /build/iOS/KeraLua.XamariniOS.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {8FAFDF62-E07E-487A-863C-74F308AE7BA6} 8 | {8FFB629D-F513-41CE-95D2-7ECE97B6EEEC};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 9 | Library 10 | KeraLua 11 | KeraLua 12 | Resources 13 | 14 | 15 | true 16 | full 17 | false 18 | ..\..\lib\Debug\xamarinios 19 | DEBUG; 20 | prompt 21 | 4 22 | true 23 | true 24 | 25 | 26 | portable 27 | true 28 | ..\..\lib\Release\xamarinios 29 | 30 | prompt 31 | 4 32 | true 33 | true 34 | ..\..\lib\Release\xamarinios\KeraLua.xml 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | Framework 47 | 48 | 49 | 50 | 51 | all 52 | runtime; build; native; contentfiles; analyzers 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /build/iOS/KeraLua.net9.0-ios.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | Library 7 | KeraLua 8 | KeraLua 9 | net9.0-ios 10 | Resources 11 | true 12 | false 13 | 14 | 15 | true 16 | full 17 | false 18 | ..\..\lib\Debug 19 | DEBUG 20 | prompt 21 | 4 22 | true 23 | true 24 | 25 | 26 | portable 27 | true 28 | ..\..\lib\Release 29 | 30 | prompt 31 | 4 32 | true 33 | true 34 | ..\..\lib\Release\net9.0-ios\KeraLua.xml 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | Framework 43 | 44 | 45 | 46 | 47 | all 48 | runtime; build; native; contentfiles; analyzers 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /build/iOS/KeraLua.net9.0-maccatalyst.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | Library 7 | KeraLua 8 | KeraLua 9 | net9.0-maccatalyst 10 | Resources 11 | true 12 | false 13 | 14 | 15 | true 16 | full 17 | false 18 | ..\..\lib\Debug 19 | DEBUG 20 | prompt 21 | 4 22 | true 23 | true 24 | 25 | 26 | portable 27 | true 28 | ..\..\lib\Release 29 | 30 | prompt 31 | 4 32 | true 33 | true 34 | ..\..\lib\Release\net9.0-maccatalyst\KeraLua.xml 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | Framework 43 | 44 | 45 | 46 | 47 | all 48 | runtime; build; native; contentfiles; analyzers 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /build/iOS/Structs.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NLua/KeraLua/e9d2f63e11e47a5a73d9f15243547ca722cca0a4/build/iOS/Structs.cs -------------------------------------------------------------------------------- /build/macOS/ApiDefinition.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NLua/KeraLua/e9d2f63e11e47a5a73d9f15243547ca722cca0a4/build/macOS/ApiDefinition.cs -------------------------------------------------------------------------------- /build/macOS/KeraLua.XamarinMac.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {4E863C20-43C3-43A0-9678-8583B9614277} 8 | {810C163F-4746-4721-8B8E-88A3673A62EA};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 9 | Library 10 | KeraLua 11 | KeraLua 12 | true 13 | Resources 14 | 15 | 16 | true 17 | full 18 | false 19 | ..\..\lib\Debug\xamarinmac 20 | DEBUG; 21 | prompt 22 | 4 23 | true 24 | 25 | 26 | portable 27 | true 28 | ..\..\lib\Release\xamarinmac 29 | prompt 30 | 4 31 | true 32 | ..\..\lib\Release\xamarinmac\KeraLua.xml 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | Dynamic 46 | False 47 | 48 | 49 | 50 | 51 | all 52 | runtime; build; native; contentfiles; analyzers 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /build/macOS/KeraLua.net9.0-macos.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | Library 7 | KeraLua 8 | KeraLua 9 | true 10 | net9.0-macos 11 | Resources 12 | true 13 | 14 | 15 | true 16 | full 17 | false 18 | ..\..\lib\Debug 19 | DEBUG; 20 | prompt 21 | 4 22 | true 23 | false 24 | false 25 | 26 | 27 | portable 28 | true 29 | ..\..\lib\Release 30 | prompt 31 | 4 32 | true 33 | ..\..\lib\Release\net9.0-macos\KeraLua.xml 34 | false 35 | false 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | Dynamic 44 | False 45 | 46 | 47 | 48 | 49 | all 50 | runtime; build; native; contentfiles; analyzers 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /build/macOS/Structs.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NLua/KeraLua/e9d2f63e11e47a5a73d9f15243547ca722cca0a4/build/macOS/Structs.cs -------------------------------------------------------------------------------- /build/net46/KeraLua.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 7.0 6 | 7 | 8 | Debug 9 | AnyCPU 10 | {C45805A8-6436-4738-BD9F-4632EEA63BBC} 11 | Library 12 | KeraLua 13 | KeraLua 14 | true 15 | v4.6 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | ..\..\lib\Debug\net46\ 23 | DEBUG;NETFRAMEWORK 24 | prompt 25 | 4 26 | false 27 | ..\..\lib\Debug\net46\KeraLua.xml 28 | true 29 | 30 | 31 | true 32 | portable 33 | ..\..\lib\Release\net46\ 34 | prompt 35 | 4 36 | false 37 | true 38 | ..\..\lib\Release\net46\KeraLua.xml 39 | NETFRAMEWORK 40 | 41 | 42 | 43 | 44 | 45 | 46 | runtime; build; native; contentfiles; analyzers; buildtransitive 47 | all 48 | 49 | 50 | runtime; build; native; contentfiles; analyzers; buildtransitive 51 | all 52 | 53 | 54 | runtime; build; native; contentfiles; analyzers; buildtransitive 55 | all 56 | 57 | 58 | runtime; build; native; contentfiles; analyzers; buildtransitive 59 | all 60 | 61 | 62 | runtime; build; native; contentfiles; analyzers; buildtransitive 63 | all 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /build/net8.0/KeraLua.net8.0.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | KeraLua 6 | KeraLua 7 | false 8 | Release;Debug 9 | 10 | 11 | portable 12 | true 13 | ..\..\lib\Release\net8.0\KeraLua.xml 14 | ..\..\lib\Release 15 | TRACE;NETCOREAPP 16 | 17 | 18 | ..\..\lib\Debug 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | runtime; build; native; contentfiles; analyzers; buildtransitive 29 | all 30 | 31 | 32 | runtime; build; native; contentfiles; analyzers; buildtransitive 33 | all 34 | 35 | 36 | runtime; build; native; contentfiles; analyzers; buildtransitive 37 | all 38 | 39 | 40 | runtime; build; native; contentfiles; analyzers; buildtransitive 41 | all 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /build/netstandard2.0/KeraLua.netstandard2.0.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | netstandard2.0 4 | KeraLua 5 | KeraLua 6 | false 7 | true 8 | Release;Debug 9 | 10 | 11 | portable 12 | true 13 | ..\..\lib\Release\netstandard2.0\KeraLua.xml 14 | ..\..\lib\Release 15 | TRACE;NETSTANDARD 16 | 17 | 18 | ..\..\lib\Debug 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /build/targets/BuildLua.Android.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | android_build 5 | android 6 | liblua54.so 7 | arm 8 | arm64 9 | x86 10 | x64 11 | 12 | 13 | 14 | $(ANDROID_NDK_HOME) 15 | $(_AndroidNdkDirectory) 16 | $(AndroidNdkHome)\ 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 36 | 41 | 46 | 51 | 52 | 53 | 54 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /build/targets/BuildLua.Common.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | $(MSBuildThisFileDirectory)..\..\external\lua 6 | $(MSBuildThisFileDirectory)..\..\runtimes 7 | 8 | -------------------------------------------------------------------------------- /build/targets/BuildLua.Linux.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | linux-x64 5 | linux-arm64 6 | lib64\liblua54.so 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /build/targets/BuildLua.MacCatalyst.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ios_build 5 | maccatalyst 6 | liblua54.framework 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /build/targets/BuildLua.OSX.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | osx-32 5 | osx-64 6 | osx-arm64 7 | osx 8 | lib64/liblua54.dylib 9 | lib/liblua54.dylib 10 | liblua54.dylib 11 | 10 12 | 12.2 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | Xcode 16.0 21 | $(OutputOfExec.Split(' ')[1]) 22 | $(OutputOfExec.Split(' ')[1].Split('.')[0]) 23 | false 24 | true 25 | true 26 | false 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /build/targets/BuildLua.TVOS.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ios_build 5 | tvos 6 | liblua54.framework 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /build/targets/BuildLua.WatchOS.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ios_build 5 | watchos 6 | liblua54.framework 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /build/targets/BuildLua.Windows.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | win-x86 5 | win-x64 6 | win-arm64 7 | win-arm 8 | bin\lua54.dll 9 | bin64\lua54.dll 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /build/targets/BuildLua.iOS.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ios_build 5 | ios 6 | liblua54.framework 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /build/targets/KeraLua.Sign.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | true 6 | NLua.snk 7 | $(MSBuildThisFileDirectory)..\..\$(KeyFileName) 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /build/targets/KeraLua.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | True 8 | 9 | 10 | 11 | 12 | $([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLower()) 13 | 14 | 15 | 16 | 17 | 18 | x64 19 | x86 20 | 21 | $(PlatformTarget) 22 | 23 | 24 | arm64 25 | 26 | x64 27 | x86 28 | 29 | $(RuntimeArch) 30 | 31 | 32 | 33 | 34 | $(MSBuildThisFileDirectory)..\..\runtimes\win-$(PreferredNativeLua)\native\lua54.dll 35 | $(MSBuildThisFileDirectory)..\..\runtimes\osx\native\liblua54.dylib 36 | $(MSBuildThisFileDirectory)..\..\runtimes\linux-$(PreferredNativeLua)\native\liblua54.so 37 | 38 | 39 | 40 | 41 | $([System.IO.Path]::GetFilename('$(PreferredWindowsNativeLuaPath)')) 42 | PreserveNewest 43 | 44 | 45 | $([System.IO.Path]::GetFilename('$(PreferredOSXNativeLuaPath)')) 46 | PreserveNewest 47 | 48 | 49 | $([System.IO.Path]::GetFilename('$(PreferredLinuxNativeLuaPath)')) 50 | PreserveNewest 51 | 52 | 53 | 54 | 55 | 56 | 57 | 59 | x86\lua54.dll 60 | PreserveNewest 61 | 62 | 64 | x64\lua54.dll 65 | PreserveNewest 66 | 67 | 69 | ARM64\lua54.dll 70 | PreserveNewest 71 | 72 | 73 | 75 | x86\liblua54.so 76 | PreserveNewest 77 | 78 | 80 | x64\liblua54.so 81 | PreserveNewest 82 | 83 | 85 | ARM64\liblua54.so 86 | PreserveNewest 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /build/uap10.0/KeraLua.UWP.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | Debug 7 | AnyCPU 8 | {8E903752-A674-467B-AB4F-112206A46140} 9 | Library 10 | Properties 11 | KeraLua 12 | KeraLua 13 | en-US 14 | UAP 15 | 10.0.19041.0 16 | 10.0.17134.0 17 | 14 18 | 512 19 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 20 | false 21 | 22 | 23 | AnyCPU 24 | true 25 | full 26 | false 27 | ..\..\lib\Debug\uap10.0\ 28 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 29 | prompt 30 | 4 31 | true 32 | ..\..\lib\Debug\uap10.0\KeraLua.xml 33 | 34 | 35 | AnyCPU 36 | portable 37 | true 38 | ..\..\lib\Release\uap10.0\ 39 | TRACE;NETFX_CORE;WINDOWS_UWP 40 | prompt 41 | 4 42 | true 43 | ..\..\lib\Release\uap10.0\KeraLua.xml 44 | 45 | 46 | PackageReference 47 | 48 | 49 | 50 | 51 | 52 | 6.2.14 53 | 54 | 55 | 56 | 14.0 57 | 58 | 59 | 60 | all 61 | runtime; build; native; contentfiles; analyzers 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /devops/BuildFunctions.ps1: -------------------------------------------------------------------------------- 1 | function Get-Current-Branch-Name () 2 | { 3 | $branch = ([string](git rev-parse --abbrev-ref HEAD)).Trim() 4 | $parts = $branch.Split('/') 5 | $branch = $parts[$parts.Length - 1] 6 | return $branch 7 | } 8 | 9 | function Get-Current-Commit-Hash () 10 | { 11 | return ([string](git log -1 --pretty=%h)).Trim() 12 | } 13 | 14 | function Get-Current-Commit-Message () 15 | { 16 | return ([string](git log -1 --pretty=%B)).Trim() 17 | } 18 | 19 | function Test-Should-Deploy () 20 | { 21 | $nugetGitVersion = Get-Git-Package-Version 22 | $buildMetaData = Get-Git-Build-MetaData 23 | $fullSemVer = Get-Git-Full-Sem-Ver 24 | 25 | if (Test-Tag-Build $nugetGitVersion $buildMetaData $fullSemVer) { 26 | return $true 27 | } 28 | return $false 29 | } 30 | 31 | function Get-Git-Package-Version () 32 | { 33 | Update-Ensure-Git-Not-Detached 34 | return [string](gitversion /showvariable MajorMinorPatch) 35 | } 36 | 37 | function Get-Git-Build-MetaData () 38 | { 39 | Update-Ensure-Git-Not-Detached 40 | return [string](gitversion /showvariable BuildMetaData) 41 | } 42 | 43 | function Get-Git-Full-Sem-Ver () 44 | { 45 | Update-Ensure-Git-Not-Detached 46 | 47 | return [string](gitversion /showvariable FullSemVer) 48 | } 49 | 50 | function Get-Git-Commit-Sha () 51 | { 52 | Update-Ensure-Git-Not-Detached 53 | 54 | return [string](gitversion /showvariable Sha) 55 | } 56 | 57 | function Update-NuSpec-Commit-Hash($File, $sha) 58 | { 59 | $File = Resolve-Path $File 60 | 61 | [xml] $fileContents = Get-Content -Encoding UTF8 -Path $File 62 | 63 | $repositoryPath = "package.metadata.repository" 64 | 65 | if ($null -ne $sha -and $sha -ne "") { 66 | Set-XmlAttributeValue -XmlDocument $fileContents -ElementPath $repositoryPath -AttributeName "commit" -AttributeValue $sha 67 | } 68 | $fileContents.Save($File) 69 | } 70 | 71 | function Update-NuSpec-Release-Notes($File, $releaseNotes) 72 | { 73 | $File = Resolve-Path $File 74 | 75 | [xml] $fileContents = Get-Content -Encoding UTF8 -Path $File 76 | 77 | $releaseNotesPath = "package.metadata.releaseNotes" 78 | 79 | if ($null -ne $releaseNotes -and $releaseNotes -ne "") { 80 | Set-XmlElementsTextValue -XmlDocument $fileContents -ElementPath $releaseNotesPath -TextValue $releaseNotes 81 | } 82 | $fileContents.Save($File) 83 | } 84 | 85 | function Update-NuSpec-Version($File, $Version) 86 | { 87 | $File = Resolve-Path $File 88 | 89 | [xml] $fileContents = Get-Content -Encoding UTF8 -Path $File 90 | 91 | $versionPath = "package.metadata.version" 92 | 93 | if ($null -ne $Version -and $Version -ne "") { 94 | Set-XmlElementsTextValue -XmlDocument $fileContents -ElementPath $versionPath -TextValue $Version 95 | } 96 | 97 | $fileContents.Save($File) 98 | } 99 | 100 | function Get-XmlNamespaceManager([xml]$XmlDocument, [string]$NamespaceURI = "") 101 | { 102 | # If a Namespace URI was not given, use the Xml document's default namespace. 103 | if ([string]::IsNullOrEmpty($NamespaceURI)) { $NamespaceURI = $XmlDocument.DocumentElement.NamespaceURI } 104 | 105 | # In order for SelectSingleNode() to actually work, we need to use the fully qualified node path along with an Xml Namespace Manager, so set them up. 106 | [System.Xml.XmlNamespaceManager]$xmlNsManager = New-Object System.Xml.XmlNamespaceManager($XmlDocument.NameTable) 107 | $xmlNsManager.AddNamespace("ns", $NamespaceURI) 108 | return ,$xmlNsManager # Need to put the comma before the variable name so that PowerShell doesn't convert it into an Object[]. 109 | } 110 | 111 | function Get-FullyQualifiedXmlNodePath([string]$NodePath, [string]$NodeSeparatorCharacter = '.') 112 | { 113 | return "/ns:$($NodePath.Replace($($NodeSeparatorCharacter), '/ns:'))" 114 | } 115 | 116 | function Get-XmlNode([xml]$XmlDocument, [string]$NodePath, [string]$NamespaceURI = "", [string]$NodeSeparatorCharacter = '.') 117 | { 118 | $xmlNsManager = Get-XmlNamespaceManager -XmlDocument $XmlDocument -NamespaceURI $NamespaceURI 119 | [string]$fullyQualifiedNodePath = Get-FullyQualifiedXmlNodePath -NodePath $NodePath -NodeSeparatorCharacter $NodeSeparatorCharacter 120 | 121 | # Try and get the node, then return it. Returns $null if the node was not found. 122 | $node = $XmlDocument.SelectSingleNode($fullyQualifiedNodePath, $xmlNsManager) 123 | return $node 124 | } 125 | 126 | function Set-XmlElementsTextValue([xml]$XmlDocument, [string]$ElementPath, [string]$TextValue, [string]$NamespaceURI = "", [string]$NodeSeparatorCharacter = '.') 127 | { 128 | # Try and get the node. 129 | $node = Get-XmlNode -XmlDocument $XmlDocument -NodePath $ElementPath -NamespaceURI $NamespaceURI -NodeSeparatorCharacter $NodeSeparatorCharacter 130 | 131 | # If the node already exists, update its value. 132 | if ($node) 133 | { 134 | $node.InnerText = $TextValue 135 | } 136 | # Else the node doesn't exist yet, so create it with the given value. 137 | else 138 | { 139 | # Create the new element with the given value. 140 | $elementName = $ElementPath.Substring($ElementPath.LastIndexOf($NodeSeparatorCharacter) + 1) 141 | $element = $XmlDocument.CreateElement($elementName, $XmlDocument.DocumentElement.NamespaceURI) 142 | $textNode = $XmlDocument.CreateTextNode($TextValue) 143 | $element.AppendChild($textNode) > $null 144 | 145 | # Try and get the parent node. 146 | $parentNodePath = $ElementPath.Substring(0, $ElementPath.LastIndexOf($NodeSeparatorCharacter)) 147 | $parentNode = Get-XmlNode -XmlDocument $XmlDocument -NodePath $parentNodePath -NamespaceURI $NamespaceURI -NodeSeparatorCharacter $NodeSeparatorCharacter 148 | 149 | if ($parentNode) 150 | { 151 | $parentNode.AppendChild($element) > $null 152 | } 153 | else 154 | { 155 | throw "$parentNodePath does not exist in the xml." 156 | } 157 | } 158 | } 159 | 160 | function Set-XmlAttributeValue([xml]$XmlDocument, [string]$ElementPath, [string]$AttributeName, [string]$AttributeValue, [string]$NamespaceURI = "", [string]$NodeSeparatorCharacter = '.') 161 | { 162 | # Try and get the node. 163 | $node = Get-XmlNode -XmlDocument $XmlDocument -NodePath $ElementPath -NamespaceURI $NamespaceURI -NodeSeparatorCharacter $NodeSeparatorCharacter 164 | 165 | # If the node already exists, update its value. 166 | if ($node) 167 | { 168 | $node.SetAttribute($AttributeName, $AttributeValue) 169 | } 170 | # Else the node doesn't exist yet, so create it with the given value. 171 | else 172 | { 173 | # Create the new element with the given value. 174 | $elementName = $ElementPath.Substring($ElementPath.LastIndexOf($NodeSeparatorCharacter) + 1) 175 | $element = $XmlDocument.CreateElement($elementName, $XmlDocument.DocumentElement.NamespaceURI) 176 | $element.SetAttribute($AttributeName, $AttributeValue) 177 | 178 | # Try and get the parent node. 179 | $parentNodePath = $ElementPath.Substring(0, $ElementPath.LastIndexOf($NodeSeparatorCharacter)) 180 | $parentNode = Get-XmlNode -XmlDocument $XmlDocument -NodePath $parentNodePath -NamespaceURI $NamespaceURI -NodeSeparatorCharacter $NodeSeparatorCharacter 181 | 182 | if ($parentNode) 183 | { 184 | $parentNode.AppendChild($element) > $null 185 | } 186 | else 187 | { 188 | throw "$parentNodePath does not exist in the xml." 189 | } 190 | } 191 | } 192 | 193 | function Test-Tag-Build ($nugetGitVersion, $buildMetaData, $fullSemVer) { 194 | if ([string]::IsNullOrEmpty($buildMetaData) -and $fullSemVer -eq $nugetGitVersion) { 195 | return $true 196 | } 197 | return $false 198 | } 199 | 200 | function Test-Stable-Release ($nugetGitVersion, $buildMetaData, $fullSemVer) 201 | { 202 | if (Test-Tag-Build $nugetGitVersion $buildMetaData $fullSemVer) { 203 | return $true 204 | } 205 | return $false 206 | } 207 | 208 | function Get-Prefix-Name () 209 | { 210 | $branchName = Get-Current-Branch-Name 211 | 212 | if ($branchName -ne "main") { 213 | return $branchName 214 | } 215 | return "beta" 216 | } 217 | 218 | function Get-Next-Version-String () 219 | { 220 | $nugetGitVersion = Get-Git-Package-Version 221 | $buildMetaData = Get-Git-Build-MetaData 222 | $fullSemVer = Get-Git-Full-Sem-Ver 223 | 224 | $prefix = Get-Prefix-Name 225 | $prefix = $prefix.Replace("-", "") 226 | $prefix = $prefix.Replace("_", "") 227 | $prefix = $prefix.Replace(".", "") 228 | $nextVersion = "" 229 | 230 | $stable = Test-Stable-Release $nugetGitVersion $buildMetaData $fullSemVer 231 | if ($stable){ 232 | $nextVersion = $nugetGitVersion 233 | } else { 234 | $nextVersion = "$($nugetGitVersion)-$($prefix)-build$($buildMetaData)" 235 | } 236 | return $nextVersion 237 | } 238 | 239 | function Test-Git-Detached () 240 | { 241 | $output = [string](git branch | head -1) 242 | $detached = $output.Contains("detached") 243 | return $detached 244 | } 245 | 246 | function Get-Git-Current-Tag 247 | { 248 | return [string](git describe --tags | head -1) 249 | } 250 | 251 | # GitVersion only works in attached branches, if we try to build a tag from the commit hash gitversion will fail 252 | # so we ensure we are always attached to a branch 253 | function Update-Ensure-Git-Not-Detached () 254 | { 255 | $detached = Test-Git-Detached 256 | if (!$detached) { 257 | return 258 | } 259 | $currentTag = Get-Git-Current-Tag 260 | $result = [string](& git checkout -B $currentTag) 261 | # We are using -B because maybe the branch alrady exist 262 | } -------------------------------------------------------------------------------- /devops/Package.ps1: -------------------------------------------------------------------------------- 1 | param ([string] $PackageId) 2 | 3 | . .\devops\BuildFunctions.ps1 4 | 5 | $hash = Get-Current-Commit-Hash 6 | $releaseNotes = "Release: $($hash)" 7 | $NuSpecFile = $PackageId + '.nuspec' 8 | $SymbolNuSpecFile = $PackageId + '.Symbol.nuspec' 9 | $longSha = Get-Git-Commit-Sha 10 | $nextVersion = Get-Next-Version-String 11 | 12 | Update-NuSpec-Version $NuSpecFile $nextVersion 13 | Update-NuSpec-Commit-Hash $NuSpecFile $longSha 14 | Update-NuSpec-Release-Notes $NuSpecFile $releaseNotes 15 | 16 | & nuget pack $NuSpecFile -NoPackageAnalysis 17 | 18 | $currentPkgName = './' + $PackageId + '.' + $nextVersion + '.nupkg' 19 | $targetPkgName = $PackageId + '.nupkg' 20 | 21 | Rename-Item -Path $currentPkgName -NewName $targetPkgName 22 | 23 | if (Test-Path -Path $SymbolNuSpecFile) { 24 | 25 | Update-NuSpec-Version $SymbolNuSpecFile $nextVersion 26 | Update-NuSpec-Commit-Hash $SymbolNuSpecFile $longSha 27 | Update-NuSpec-Release-Notes $SymbolNuSpecFile $releaseNotes 28 | 29 | & nuget pack $SymbolNuSpecFile -Symbols -SymbolPackageFormat snupkg -NoPackageAnalysis 30 | 31 | $currentPkgName = './' + $PackageId + '.' + $nextVersion + '.snupkg' 32 | $targetPkgName = $PackageId + '.snupkg' 33 | 34 | Rename-Item -Path $currentPkgName -NewName $targetPkgName 35 | } 36 | -------------------------------------------------------------------------------- /devops/PreBuild.ps1: -------------------------------------------------------------------------------- 1 | gitversion /updateassemblyinfo 2 | -------------------------------------------------------------------------------- /devops/Publish.ps1: -------------------------------------------------------------------------------- 1 | param ([string] $PackageId) 2 | 3 | . .\devops\BuildFunctions.ps1 4 | 5 | if (-Not (Test-Should-Deploy)) { 6 | return 7 | } 8 | 9 | $nupkgFile = $PackageId + '.nupkg' 10 | 11 | & nuget push $nupkgFile -Source https://api.nuget.org/v3/index.json 12 | 13 | -------------------------------------------------------------------------------- /devops/azure-devops.yml: -------------------------------------------------------------------------------- 1 | # Repo: codefoco/AzureDevopsTemplates 2 | resources: 3 | repositories: 4 | - repository: templates 5 | type: github 6 | name: codefoco/AzureDevopsTemplates 7 | endpoint: codefoco 8 | 9 | stages: 10 | 11 | - stage: Build_Mac 12 | displayName: 'Build Mac' 13 | 14 | jobs: 15 | - job: 'KeraLuaMac' 16 | displayName: 'Mac' 17 | variables: 18 | - group: 'Keys' 19 | 20 | pool: 21 | vmImage: 'macOS-15' 22 | demands: msbuild 23 | 24 | steps: 25 | - checkout: self 26 | submodules: 'true' 27 | 28 | - template: common-dotnet.yml@templates 29 | - template: common-macos.yml@templates 30 | 31 | - task: NuGetCommand@2 32 | displayName: 'NuGet restore KeraLua.Mac.sln' 33 | inputs: 34 | restoreSolution: KeraLua.Mac.sln 35 | 36 | - task: NuGetCommand@2 37 | displayName: 'NuGet restore KeraLua.sln' 38 | inputs: 39 | restoreSolution: KeraLua.sln 40 | 41 | - task: PowerShell@2 42 | displayName: 'PowerShell Script' 43 | inputs: 44 | targetType: filePath 45 | filePath: ./devops/PreBuild.ps1 46 | arguments: 'KeraLua' 47 | pwsh: true 48 | 49 | - task: MSBuild@1 50 | displayName: 'Build solution KeraLua.sln' 51 | inputs: 52 | solution: KeraLua.sln 53 | configuration: Release 54 | 55 | - task: MSBuild@1 56 | displayName: 'Build solution KeraLua.Mac.sln' 57 | inputs: 58 | solution: KeraLua.Mac.sln 59 | configuration: Release 60 | 61 | - task: DotNetCoreCLI@2 62 | displayName: 'dotnet build ./build/iOS/KeraLua.net9.0-ios.csproj' 63 | inputs: 64 | command: custom 65 | custom: build 66 | arguments: './build/iOS/KeraLua.net9.0-ios.csproj /p:Configuration=Release' 67 | 68 | - task: DotNetCoreCLI@2 69 | displayName: 'dotnet build ./build/iOS/KeraLua.net9.0-maccatalyst.csproj' 70 | inputs: 71 | command: custom 72 | custom: build 73 | arguments: './build/iOS/KeraLua.net9.0-maccatalyst.csproj /p:Configuration=Release' 74 | 75 | - task: DotNetCoreCLI@2 76 | displayName: 'dotnet build ./build/macOS/KeraLua.net9.0-macos.csproj' 77 | inputs: 78 | command: custom 79 | custom: build 80 | arguments: './build/macOS/KeraLua.net9.0-macos.csproj /p:Configuration=Release' 81 | 82 | - task: DotNetCoreCLI@2 83 | displayName: 'dotnet build ./build/TVOS/KeraLua.net9.0-tvos.csproj' 84 | inputs: 85 | command: custom 86 | custom: build 87 | arguments: './build/TVOS/KeraLua.net9.0-tvos.csproj /p:Configuration=Release' 88 | 89 | - script: 'nuget install NUnit.ConsoleRunner -Version 3.16.3 -source "https://api.nuget.org/v3/index.json" -OutputDirectory .' 90 | workingDirectory: ./ 91 | displayName: 'nuget install NUnit.ConsoleRunner' 92 | 93 | # reverted back to use NUnit.ConsoleRunner because Microsoft keeps breaking .NET 94 | - script: 'mono NUnit.ConsoleRunner.3.16.3/tools/nunit3-console.exe ./tests/build/net46/bin/Release/KeraLuaTest.dll' 95 | displayName: 'Run OSX tests' 96 | 97 | - script: 'mv TestResult.xml ./KeraLuaTest.Mac.xml' 98 | displayName: 'Rename Test result' 99 | 100 | - task: PublishTestResults@2 101 | inputs: 102 | testResultsFormat: 'VSTest' 103 | testResultsFiles: 'KeraLuaTest.Mac.xml' 104 | failTaskOnFailedTests: true 105 | 106 | - task: PublishPipelineArtifact@1 107 | displayName: 'Publish KeraLuaTest.Mac.xml' 108 | inputs: 109 | targetPath: KeraLuaTest.Mac.xml 110 | artifact: 'KeraLuaTest.Mac.xml' 111 | publishLocation: 'pipeline' 112 | 113 | - task: PublishPipelineArtifact@1 114 | displayName: 'Publish Pipeline Artifact: libs.mac' 115 | inputs: 116 | targetPath: lib/Release/ 117 | artifact: 'libs.mac' 118 | publishLocation: 'pipeline' 119 | 120 | - task: PublishPipelineArtifact@1 121 | displayName: 'Publish Pipeline Artifact: runtimes' 122 | inputs: 123 | targetPath: runtimes 124 | artifact: 'runtimes.mac' 125 | publishLocation: 'pipeline' 126 | 127 | - template: send-telegram.yml@templates 128 | 129 | - stage: Build_Linux 130 | displayName: 'Build Linux' 131 | jobs: 132 | 133 | - job: 'KeraLuaLinux' 134 | displayName: 'Linux' 135 | variables: 136 | - group: 'Keys' 137 | 138 | pool: 139 | vmImage: 'ubuntu-22.04' 140 | demands: msbuild 141 | variables: 142 | CC: gcc-9.3 143 | CXX: g++-9.3 144 | 145 | steps: 146 | - template: common-linux-ubuntu.yaml@templates 147 | - template: common-dotnet.yml@templates 148 | 149 | - checkout: self 150 | submodules: 'true' 151 | 152 | - script: 'sudo apt update; sudo apt install gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu g++-aarch64-linux-gnu' 153 | displayName: 'Install ARM64 build tools' 154 | 155 | - task: NuGetCommand@2 156 | displayName: 'NuGet restore' 157 | inputs: 158 | restoreSolution: KeraLua.sln 159 | 160 | - task: MSBuild@1 161 | displayName: 'Build solution KeraLua.sln' 162 | inputs: 163 | solution: KeraLua.sln 164 | configuration: Release 165 | 166 | - task: PublishPipelineArtifact@1 167 | displayName: 'Publish Pipeline Artifact: liblua54.so' 168 | inputs: 169 | targetPath: 'runtimes/linux-x64/native/liblua54.so' 170 | artifact: 'liblua54.so.x64' 171 | publishLocation: 'pipeline' 172 | 173 | - task: PublishPipelineArtifact@1 174 | displayName: 'Publish Pipeline Artifact: liblua54.so' 175 | inputs: 176 | targetPath: 'runtimes/linux-arm64/native/liblua54.so' 177 | artifact: 'liblua54.so.arm64' 178 | publishLocation: 'pipeline' 179 | 180 | - template: send-telegram.yml@templates 181 | 182 | - stage: Build_Windows 183 | displayName: Build Windows 184 | dependsOn: ['Build_Mac', 'Build_Linux'] 185 | 186 | jobs: 187 | - job: 'KeraLuaWindows' 188 | displayName: 'Windows' 189 | variables: 190 | - group: 'Keys' 191 | - name: WindowsSDKVersion 192 | value: 10.0.22621.0 193 | 194 | pool: 195 | vmImage: 'windows-2022' 196 | demands: 197 | - msbuild 198 | - visualstudio 199 | 200 | steps: 201 | - checkout: self 202 | submodules: true 203 | 204 | - template: common-dotnet.yml@templates 205 | - template: common-win.yml@templates 206 | 207 | - task: NuGetCommand@2 208 | displayName: 'NuGet restore KeraLua.sln' 209 | inputs: 210 | restoreSolution: KeraLua.sln 211 | 212 | - task: NuGetCommand@2 213 | displayName: 'NuGet restore KeraLua.UWP.sln' 214 | inputs: 215 | restoreSolution: KeraLua.UWP.sln 216 | 217 | - task: DotNetCoreCLI@2 218 | displayName: 'dotnet restore KeraLua.net9.0-android.sln' 219 | inputs: 220 | command: custom 221 | custom: restore 222 | arguments: '.\KeraLua.net9.0-android.sln' 223 | 224 | - task: DotNetCoreCLI@2 225 | displayName: 'dotnet restore KeraLua.net8.0.sln' 226 | inputs: 227 | command: custom 228 | custom: restore 229 | arguments: '.\KeraLua.net8.0.sln' 230 | 231 | - task: DotNetCoreCLI@2 232 | displayName: 'dotnet restore KeraLua.netstandard.sln' 233 | inputs: 234 | command: custom 235 | custom: restore 236 | arguments: '.\KeraLua.netstandard.sln' 237 | 238 | - task: PowerShell@2 239 | displayName: 'PreBuild Script' 240 | inputs: 241 | filePath: './devops/PreBuild.ps1' 242 | arguments: 'KeraLua' 243 | errorActionPreference: 'silentlyContinue' 244 | pwsh: true 245 | 246 | - task: MSBuild@1 247 | displayName: 'Build solution KeraLua.sln' 248 | inputs: 249 | solution: KeraLua.sln 250 | configuration: Release 251 | 252 | - task: MSBuild@1 253 | displayName: 'Build solution KeraLua.UWP.sln' 254 | inputs: 255 | solution: KeraLua.UWP.sln 256 | configuration: Release 257 | 258 | - task: DotNetCoreCLI@2 259 | displayName: 'dotnet build KeraLua.net8.0.sln' 260 | inputs: 261 | command: custom 262 | custom: build 263 | arguments: '.\KeraLua.net8.0.sln /p:Configuration=Release' 264 | 265 | - task: DotNetCoreCLI@2 266 | displayName: 'dotnet build KeraLua.netstandard.sln' 267 | inputs: 268 | command: custom 269 | custom: build 270 | arguments: '.\KeraLua.netstandard.sln /p:Configuration=Release' 271 | 272 | - task: DotNetCoreCLI@2 273 | displayName: 'dotnet build build/Android/KeraLua.net9.0-android.csproj' 274 | inputs: 275 | command: custom 276 | custom: build 277 | arguments: '.\build\Android\KeraLua.net9.0-android.csproj /p:Configuration=Release /p:AndroidNdkDirectory="C:\Android\android-sdk\ndk-bundle"' 278 | 279 | - task: DotNetCoreCLI@2 280 | displayName: 'dotnet vstest' 281 | inputs: 282 | command: custom 283 | custom: vstest 284 | arguments: 'tests\build\net9.0\bin\Release\net9.0\KeraLuaTest.net9.0.dll' 285 | 286 | - task: NuGetCommand@2 287 | displayName: 'NuGet restore Android solution' 288 | inputs: 289 | restoreSolution: KeraLua.Android.sln 290 | 291 | - task: MSBuild@1 292 | displayName: 'Build Android' 293 | inputs: 294 | solution: 'KeraLua.Android.sln' 295 | platform: 'Any CPU' 296 | configuration: 'Release' 297 | msbuildArguments: '/p:AndroidNdkDirectory="C:\Android\android-sdk\ndk-bundle"' 298 | 299 | # reverted back to use NUnit.ConsoleRunner because Microsoft keeps breaking .NET 300 | - script: 'nunit3-console.exe ./tests/build/net46/bin/Release/KeraLuaTest.dll --x86' 301 | displayName: 'Run Windows tests' 302 | 303 | - script: 'RENAME TestResult.xml KeraLuaTest.Windows.xml' 304 | displayName: 'Rename Test result' 305 | 306 | - script: 'MOVE KeraLuaTest.Windows.xml .' 307 | displayName: 'Move Test result' 308 | 309 | - task: PublishTestResults@2 310 | inputs: 311 | testResultsFormat: 'VSTest' 312 | testResultsFiles: 'KeraLuaTest.Windows.xml' 313 | failTaskOnFailedTests: true 314 | 315 | - task: PublishPipelineArtifact@1 316 | displayName: 'Publish KeraLuaTest.Windows.xml' 317 | inputs: 318 | targetPath: KeraLuaTest.Windows.xml 319 | artifact: 'KeraLuaTest.Windows.xml' 320 | publishLocation: 'pipeline' 321 | 322 | - task: DownloadPipelineArtifact@2 323 | displayName: 'Download Build libs.mac' 324 | inputs: 325 | buildType: 'current' 326 | artifactName: 'libs.mac' 327 | targetPath: './lib/Release/' 328 | 329 | - task: DownloadPipelineArtifact@2 330 | displayName: 'Download Build runtimes.mac' 331 | inputs: 332 | buildType: 'current' 333 | artifactName: 'runtimes.mac' 334 | targetPath: './runtimes/' 335 | 336 | - task: DownloadPipelineArtifact@2 337 | displayName: 'Download Build liblua54.so x64 (Linux)' 338 | inputs: 339 | buildType: 'current' 340 | artifactName: 'liblua54.so.x64' 341 | targetPath: 'runtimes/linux-x64/native/' 342 | 343 | - task: DownloadPipelineArtifact@2 344 | displayName: 'Download Build liblua54.so arm64 (Linux)' 345 | inputs: 346 | buildType: 'current' 347 | artifactName: 'liblua54.so.arm64' 348 | targetPath: 'runtimes/linux-arm64/native/' 349 | 350 | - script: 'nuget setapikey $(apikey)' 351 | displayName: 'Set NuGet API Key' 352 | 353 | - task: PowerShell@2 354 | displayName: 'Package NuGet' 355 | inputs: 356 | targetType: filePath 357 | filePath: ./devops/Package.ps1 358 | arguments: 'KeraLua' 359 | pwsh: true 360 | 361 | - task: PublishBuildArtifacts@1 362 | displayName: 'Save KeraLua.nupkg Artifact' 363 | inputs: 364 | PathtoPublish: KeraLua.nupkg 365 | ArtifactName: KeraLua.nupkg 366 | 367 | - task: PublishBuildArtifacts@1 368 | displayName: 'Save KeraLua.snupkg Artifact' 369 | inputs: 370 | PathtoPublish: KeraLua.snupkg 371 | ArtifactName: KeraLua.snupkg 372 | 373 | - task: PowerShell@2 374 | displayName: 'Publish NuGet' 375 | inputs: 376 | targetType: filePath 377 | filePath: ./devops/Publish.ps1 378 | arguments: KeraLua 379 | pwsh: true 380 | 381 | - template: send-telegram.yml@templates 382 | -------------------------------------------------------------------------------- /src/.editorconfig: -------------------------------------------------------------------------------- 1 | ############################### 2 | # Core EditorConfig Options # 3 | ############################### 4 | 5 | root = true 6 | 7 | # All files 8 | [*] 9 | indent_style = space 10 | 11 | # Code files 12 | [*.{cs,csx,vb,vbx}] 13 | indent_size = 4 14 | insert_final_newline = true 15 | charset = utf-8-bom 16 | 17 | ############################### 18 | # .NET Coding Conventions # 19 | ############################### 20 | 21 | [*.{cs,vb}] 22 | # Organize usings 23 | dotnet_sort_system_directives_first = true 24 | dotnet_separate_import_directive_groups = false 25 | 26 | # this. preferences 27 | dotnet_style_qualification_for_field = false:none 28 | dotnet_style_qualification_for_property = false:none 29 | dotnet_style_qualification_for_method = false:none 30 | dotnet_style_qualification_for_event = false:none 31 | 32 | # Language keywords vs BCL types preferences 33 | dotnet_style_predefined_type_for_locals_parameters_members = true:none 34 | dotnet_style_predefined_type_for_member_access = true:none 35 | 36 | # Parentheses preferences 37 | dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent 38 | dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent 39 | dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent 40 | dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent 41 | 42 | # Modifier preferences 43 | dotnet_style_require_accessibility_modifiers = for_non_interface_members:none 44 | dotnet_style_readonly_field = true:suggestion 45 | 46 | # Expression-level preferences 47 | dotnet_style_object_initializer = true:suggestion 48 | dotnet_style_collection_initializer = true:suggestion 49 | dotnet_style_explicit_tuple_names = true:suggestion 50 | dotnet_style_null_propagation = true:suggestion 51 | dotnet_style_coalesce_expression = true:suggestion 52 | dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent 53 | dotnet_style_prefer_inferred_tuple_names = true:suggestion 54 | dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion 55 | dotnet_style_prefer_auto_properties = true:silent 56 | dotnet_style_prefer_conditional_expression_over_assignment = true:silent 57 | dotnet_style_prefer_conditional_expression_over_return = true:silent 58 | 59 | ############################### 60 | # Naming Conventions # 61 | ############################### 62 | 63 | # Style Definitions 64 | dotnet_naming_style.pascal_case_style.capitalization = pascal_case 65 | 66 | # Use PascalCase for constant fields 67 | dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion 68 | dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields 69 | dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style 70 | dotnet_naming_symbols.constant_fields.applicable_kinds = field 71 | dotnet_naming_symbols.constant_fields.applicable_accessibilities = * 72 | dotnet_naming_symbols.constant_fields.required_modifiers = const 73 | 74 | ############################### 75 | # C# Code Style Rules # 76 | ############################### 77 | 78 | [*.cs] 79 | # var preferences 80 | csharp_style_var_for_built_in_types = false:none 81 | csharp_style_var_when_type_is_apparent = true:suggestion 82 | csharp_style_var_elsewhere = false:none 83 | 84 | # Expression-bodied members 85 | csharp_style_expression_bodied_methods = false:none 86 | csharp_style_expression_bodied_constructors = false:none 87 | csharp_style_expression_bodied_operators = false:none 88 | csharp_style_expression_bodied_properties = true:none 89 | csharp_style_expression_bodied_indexers = true:none 90 | csharp_style_expression_bodied_accessors = true:none 91 | 92 | # Pattern-matching preferences 93 | csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion 94 | csharp_style_pattern_matching_over_as_with_null_check = true:suggestion 95 | 96 | # Null-checking preferences 97 | csharp_style_throw_expression = true:suggestion 98 | csharp_style_conditional_delegate_call = true:suggestion 99 | 100 | # Modifier preferences 101 | csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion 102 | 103 | # Expression-level preferences 104 | csharp_prefer_braces = true:none 105 | csharp_style_deconstructed_variable_declaration = true:suggestion 106 | csharp_prefer_simple_default_expression = true:suggestion 107 | csharp_style_pattern_local_over_anonymous_function = true:suggestion 108 | csharp_style_inlined_variable_declaration = true:suggestion 109 | 110 | ############################### 111 | # C# Formatting Rules # 112 | ############################### 113 | 114 | # New line preferences 115 | csharp_new_line_before_open_brace = all 116 | csharp_new_line_before_else = true 117 | csharp_new_line_before_catch = true 118 | csharp_new_line_before_finally = true 119 | csharp_new_line_before_members_in_object_initializers = true 120 | csharp_new_line_before_members_in_anonymous_types = true 121 | csharp_new_line_between_query_expression_clauses = true 122 | 123 | # Indentation preferences 124 | csharp_indent_case_contents = true 125 | csharp_indent_switch_labels = true 126 | csharp_indent_labels = flush_left 127 | 128 | # Space preferences 129 | csharp_space_after_cast = false 130 | csharp_space_after_keywords_in_control_flow_statements = true 131 | csharp_space_between_method_call_parameter_list_parentheses = false 132 | csharp_space_between_method_declaration_parameter_list_parentheses = false 133 | csharp_space_between_parentheses = false 134 | csharp_space_before_colon_in_inheritance_clause = true 135 | csharp_space_after_colon_in_inheritance_clause = true 136 | csharp_space_around_binary_operators = before_and_after 137 | csharp_space_between_method_declaration_empty_parameter_list_parentheses = false 138 | csharp_space_between_method_call_name_and_opening_parenthesis = false 139 | csharp_space_between_method_call_empty_parameter_list_parentheses = false 140 | 141 | # Wrapping preferences 142 | csharp_preserve_single_line_statements = true 143 | csharp_preserve_single_line_blocks = true 144 | 145 | ################################## 146 | # Visual Basic Code Style Rules # 147 | ################################## 148 | 149 | [*.vb] 150 | # Modifier preferences 151 | visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:suggestion -------------------------------------------------------------------------------- /src/DelegateExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace KeraLua 5 | { 6 | static class DelegateExtensions 7 | { 8 | public static LuaFunction ToLuaFunction(this IntPtr ptr) 9 | { 10 | if (ptr == IntPtr.Zero) 11 | return null; 12 | 13 | return Marshal.GetDelegateForFunctionPointer(ptr); 14 | } 15 | 16 | public static IntPtr ToFunctionPointer(this LuaFunction d) 17 | { 18 | if (d == null) 19 | return IntPtr.Zero; 20 | 21 | return Marshal.GetFunctionPointerForDelegate(d); 22 | } 23 | 24 | public static LuaHookFunction ToLuaHookFunction(this IntPtr ptr) 25 | { 26 | if (ptr == IntPtr.Zero) 27 | return null; 28 | 29 | return Marshal.GetDelegateForFunctionPointer(ptr); 30 | } 31 | 32 | public static IntPtr ToFunctionPointer(this LuaHookFunction d) 33 | { 34 | if (d == null) 35 | return IntPtr.Zero; 36 | 37 | return Marshal.GetFunctionPointerForDelegate(d); 38 | } 39 | 40 | public static LuaKFunction ToLuaKFunction(this IntPtr ptr) 41 | { 42 | if (ptr == IntPtr.Zero) 43 | return null; 44 | 45 | return Marshal.GetDelegateForFunctionPointer(ptr); 46 | } 47 | 48 | public static IntPtr ToFunctionPointer(this LuaKFunction d) 49 | { 50 | if (d == null) 51 | return IntPtr.Zero; 52 | 53 | return Marshal.GetFunctionPointerForDelegate(d); 54 | } 55 | 56 | public static LuaReader ToLuaReader(this IntPtr ptr) 57 | { 58 | if (ptr == IntPtr.Zero) 59 | return null; 60 | 61 | return Marshal.GetDelegateForFunctionPointer(ptr); 62 | } 63 | 64 | public static IntPtr ToFunctionPointer(this LuaReader d) 65 | { 66 | if (d == null) 67 | return IntPtr.Zero; 68 | 69 | return Marshal.GetFunctionPointerForDelegate(d); 70 | } 71 | 72 | public static LuaWriter ToLuaWriter(this IntPtr ptr) 73 | { 74 | if (ptr == IntPtr.Zero) 75 | return null; 76 | 77 | return Marshal.GetDelegateForFunctionPointer(ptr); 78 | } 79 | 80 | public static IntPtr ToFunctionPointer(this LuaWriter d) 81 | { 82 | if (d == null) 83 | return IntPtr.Zero; 84 | 85 | return Marshal.GetFunctionPointerForDelegate(d); 86 | } 87 | 88 | public static LuaAlloc ToLuaAlloc(this IntPtr ptr) 89 | { 90 | if (ptr == IntPtr.Zero) 91 | return null; 92 | 93 | return Marshal.GetDelegateForFunctionPointer(ptr); 94 | } 95 | 96 | public static IntPtr ToFunctionPointer(this LuaAlloc d) 97 | { 98 | if (d == null) 99 | return IntPtr.Zero; 100 | 101 | return Marshal.GetFunctionPointerForDelegate(d); 102 | } 103 | 104 | public static LuaWarnFunction ToLuaWarning(this IntPtr ptr) 105 | { 106 | if (ptr == IntPtr.Zero) 107 | return null; 108 | 109 | return Marshal.GetDelegateForFunctionPointer(ptr); 110 | } 111 | 112 | public static IntPtr ToFunctionPointer(this LuaWarnFunction d) 113 | { 114 | if (d == null) 115 | return IntPtr.Zero; 116 | 117 | return Marshal.GetFunctionPointerForDelegate(d); 118 | } 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /src/Delegates.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | using System.Security; 3 | using charptr_t = System.IntPtr; 4 | using lua_Debug = System.IntPtr; 5 | using lua_KContext = System.IntPtr; 6 | using lua_State = System.IntPtr; 7 | using size_t = System.UIntPtr; 8 | using voidptr_t = System.IntPtr; 9 | 10 | #if __IOS__ || __TVOS__ || __WATCHOS__ || __MACCATALYST__ 11 | using ObjCRuntime; 12 | #endif 13 | 14 | namespace KeraLua 15 | { 16 | /// 17 | /// Type for C# callbacks 18 | /// In order to communicate properly with Lua, a C function must use the following protocol, which defines the way parameters and results are passed: a C function receives its arguments from Lua in its stack in direct order (the first argument is pushed first). So, when the function starts, lua_gettop(L) returns the number of arguments received by the function. The first argument (if any) is at index 1 and its last argument is at index lua_gettop(L). To return values to Lua, a C function just pushes them onto the stack, in direct order (the first result is pushed first), and returns the number of results. Any other value in the stack below the results will be properly discarded by Lua. Like a Lua function, a C function called by Lua can also return many results. 19 | /// 20 | /// 21 | /// 22 | [SuppressUnmanagedCodeSecurity] 23 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 24 | #if __IOS__ || __TVOS__ || __WATCHOS__ || __MACCATALYST__ 25 | [MonoNativeFunctionWrapper] 26 | #endif 27 | public delegate int LuaFunction(lua_State luaState); 28 | 29 | /// 30 | /// Type for debugging hook functions callbacks. 31 | /// 32 | /// 33 | /// 34 | [SuppressUnmanagedCodeSecurity] 35 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 36 | #if __IOS__ || __TVOS__ || __WATCHOS__ || __MACCATALYST__ 37 | [MonoNativeFunctionWrapper] 38 | #endif 39 | public delegate void LuaHookFunction(lua_State luaState, lua_Debug ar); 40 | 41 | /// 42 | /// Type for continuation functions 43 | /// 44 | /// 45 | /// 46 | /// 47 | /// 48 | [SuppressUnmanagedCodeSecurity] 49 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 50 | #if __IOS__ || __TVOS__ || __WATCHOS__ || __MACCATALYST__ 51 | [MonoNativeFunctionWrapper] 52 | #endif 53 | public delegate int LuaKFunction(lua_State L, int status, lua_KContext ctx); 54 | 55 | /// 56 | /// The reader function used by lua_load. Every time it needs another piece of the chunk, lua_load calls the reader, passing along its data parameter. The reader must return a pointer to a block of memory with a new piece of the chunk and set size to the block size 57 | /// 58 | /// 59 | /// 60 | /// 61 | /// 62 | [SuppressUnmanagedCodeSecurity] 63 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 64 | #if __IOS__ || __TVOS__ || __WATCHOS__ || __MACCATALYST__ 65 | [MonoNativeFunctionWrapper] 66 | #endif 67 | public delegate charptr_t LuaReader(lua_State L, voidptr_t ud, ref size_t sz); 68 | 69 | /// 70 | /// 71 | /// 72 | /// 73 | /// 74 | /// 75 | /// 76 | /// 77 | [SuppressUnmanagedCodeSecurity] 78 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 79 | #if __IOS__ || __TVOS__ || __WATCHOS__ || __MACCATALYST__ 80 | [MonoNativeFunctionWrapper] 81 | #endif 82 | public delegate int LuaWriter(lua_State L, voidptr_t p, size_t size, voidptr_t ud); 83 | 84 | /// 85 | /// The type of the memory-allocation function used by Lua states. The allocator function must provide a functionality similar to realloc 86 | /// 87 | /// 88 | /// 89 | /// 90 | /// 91 | /// 92 | [SuppressUnmanagedCodeSecurity] 93 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 94 | #if __IOS__ || __TVOS__ || __WATCHOS__ || __MACCATALYST__ 95 | [MonoNativeFunctionWrapper] 96 | #endif 97 | public delegate voidptr_t LuaAlloc(voidptr_t ud, voidptr_t ptr, size_t osize, size_t nsize); 98 | 99 | /// 100 | /// Type for warning functions 101 | /// 102 | /// 103 | /// 104 | /// 105 | [SuppressUnmanagedCodeSecurity] 106 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 107 | #if __IOS__ || __TVOS__ || __WATCHOS__ || __MACCATALYST__ 108 | [MonoNativeFunctionWrapper] 109 | #endif 110 | public delegate void LuaWarnFunction(voidptr_t ud, charptr_t msg, int tocont); 111 | 112 | } 113 | -------------------------------------------------------------------------------- /src/KeraLua.Core.projitems: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | true 6 | {BD205AD6-760E-48F3-BAB2-21447396BD17} 7 | 8 | 9 | KeraLua 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/KeraLua.Shared.shproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {BD205AD6-760E-48F3-BAB2-21447396BD17} 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/LuaCompare.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace KeraLua 6 | { 7 | /// 8 | /// Used by Compare 9 | /// 10 | public enum LuaCompare 11 | { 12 | /// 13 | /// compares for equality (==) 14 | /// 15 | Equal = 0, 16 | /// 17 | /// compares for less than 18 | /// 19 | LessThen = 1, 20 | /// 21 | /// compares for less or equal 22 | /// 23 | LessOrEqual = 2 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/LuaDebug.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Text; 4 | 5 | namespace KeraLua 6 | { 7 | /// 8 | /// Structure for lua debug information 9 | /// 10 | /// 11 | /// Do not change this struct because it must match the lua structure lua_Debug 12 | /// 13 | /// Reinhard Ostermeier 14 | [StructLayout(LayoutKind.Sequential)] 15 | public struct LuaDebug 16 | { 17 | /// 18 | /// Get a LuaDebug from IntPtr 19 | /// 20 | /// 21 | /// 22 | public static LuaDebug FromIntPtr(IntPtr ar) 23 | { 24 | return Marshal.PtrToStructure(ar); 25 | } 26 | /// 27 | /// Debug event code 28 | /// 29 | [MarshalAs(UnmanagedType.I4)] 30 | public LuaHookEvent Event; 31 | /// 32 | /// a reasonable name for the given function. Because functions in Lua are first-class values, they do not have a fixed name: some functions can be the value of multiple global variables, while others can be stored only in a table field 33 | /// 34 | public string Name => Marshal.PtrToStringAnsi(name); 35 | IntPtr name; 36 | /// 37 | /// explains the name field. The value of namewhat can be "global", "local", "method", "field", "upvalue", or "" (the empty string) 38 | /// 39 | public string NameWhat => Marshal.PtrToStringAnsi(what); 40 | IntPtr nameWhat; 41 | /// 42 | /// the string "Lua" if the function is a Lua function, "C" if it is a C function, "main" if it is the main part of a chunk 43 | /// 44 | public string What => Marshal.PtrToStringAnsi(what); 45 | IntPtr what; 46 | /// 47 | /// the name of the chunk that created the function. If source starts with a '@', it means that the function was defined in a file where the file name follows the '@'. 48 | /// 49 | /// 50 | public string Source => Marshal.PtrToStringAnsi(source, SourceLength); 51 | IntPtr source; 52 | 53 | /// 54 | /// The length of the string source 55 | /// 56 | public int SourceLength => sourceLen.ToInt32(); 57 | IntPtr sourceLen; 58 | 59 | /// 60 | /// the current line where the given function is executing. When no line information is available, currentline is set to -1 61 | /// 62 | public int CurrentLine; 63 | /// 64 | /// 65 | /// 66 | public int LineDefined; 67 | /// 68 | /// the line number where the definition of the function ends. 69 | /// 70 | public int LastLineDefined; 71 | /// 72 | /// number of upvalues 73 | /// 74 | public byte NumberUpValues; 75 | /// 76 | /// number of parameters 77 | /// 78 | public byte NumberParameters; 79 | /// 80 | /// true if the function is a vararg function (always true for C functions). 81 | /// 82 | [MarshalAs(UnmanagedType.I1)] 83 | public bool IsVarArg; /* (u) */ 84 | /// 85 | /// true if this function invocation was called by a tail call. In this case, the caller of this level is not in the stack. 86 | /// 87 | [MarshalAs(UnmanagedType.I1)] 88 | public bool IsTailCall; /* (t) */ 89 | 90 | /// 91 | /// The index on the stack of the first value being "transferred", that is, parameters in a call or return values in a return. (The other values are in consecutive indices.) Using this index, you can access and modify these values through lua_getlocal and lua_setlocal. This field is only meaningful during a call hook, denoting the first parameter, or a return hook, denoting the first value being returned. (For call hooks, this value is always 1.) 92 | /// 93 | public ushort IndexFirstValue; /* (r) index of first value transferred */ 94 | 95 | /// 96 | /// The number of values being transferred (see previous item). (For calls of Lua functions, this value is always equal to nparams.) 97 | /// 98 | public ushort NumberTransferredValues; /* (r) number of transferred values */ 99 | 100 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = 60)] 101 | byte[] shortSource; 102 | 103 | /// 104 | /// a "printable" version of source, to be used in error messages 105 | /// 106 | public string ShortSource 107 | { 108 | get 109 | { 110 | if (shortSource[0] == 0) 111 | return string.Empty; 112 | 113 | int count = 0; 114 | 115 | while (count < shortSource.Length && shortSource[count] != 0) 116 | { 117 | count++; 118 | } 119 | 120 | return Encoding.ASCII.GetString(shortSource, 0, count); 121 | } 122 | } 123 | IntPtr i_ci; 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /src/LuaGC.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace KeraLua 6 | { 7 | /// 8 | /// Garbage Collector operations 9 | /// 10 | public enum LuaGC 11 | { 12 | /// 13 | /// Stops the garbage collector. 14 | /// 15 | Stop = 0, 16 | /// 17 | /// Restarts the garbage collector. 18 | /// 19 | Restart = 1, 20 | /// 21 | /// Performs a full garbage-collection cycle. 22 | /// 23 | Collect = 2, 24 | /// 25 | /// Returns the current amount of memory (in Kbytes) in use by Lua. 26 | /// 27 | Count = 3, 28 | /// 29 | /// Returns the remainder of dividing the current amount of bytes of memory in use by Lua by 1024 30 | /// 31 | Countb = 4, 32 | /// 33 | /// Performs an incremental step of garbage collection. 34 | /// 35 | Step = 5, 36 | /// 37 | /// The options LUA_GCSETPAUSE and LUA_GCSETSTEPMUL of the function lua_gc are deprecated. You should use the new option LUA_GCINC to set them. 38 | /// 39 | [Obsolete("Deprecatad since Lua 5.4, Use Incremental instead")] 40 | SetPause = 6, 41 | /// 42 | /// The options LUA_GCSETPAUSE and LUA_GCSETSTEPMUL of the function lua_gc are deprecated. You should use the new option LUA_GCINC to set them. 43 | /// 44 | [Obsolete("Deprecatad since Lua 5.4, Use Incremental instead")] 45 | SetStepMultiplier = 7, 46 | /// 47 | /// returns a boolean that tells whether the collector is running 48 | /// 49 | IsRunning = 9, 50 | /// 51 | /// Changes the collector to generational mode with the given parameters (see §2.5.2). Returns the previous mode (LUA_GCGEN or LUA_GCINC). 52 | /// 53 | Generational = 10, 54 | /// 55 | /// Changes the collector to incremental mode with the given parameters (see §2.5.1). Returns the previous mode (LUA_GCGEN or LUA_GCINC). 56 | /// 57 | Incremental = 11, 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/LuaHookEvent.cs: -------------------------------------------------------------------------------- 1 | namespace KeraLua 2 | { 3 | /// 4 | /// Whenever a hook is called, its ar argument has its field event set to the specific event that triggered the hook 5 | /// 6 | public enum LuaHookEvent 7 | { 8 | /// 9 | /// The call hook: is called when the interpreter calls a function. The hook is called just after Lua enters the new function, before the function gets its arguments. 10 | /// 11 | Call = 0, 12 | /// 13 | /// The return hook: is called when the interpreter returns from a function. The hook is called just before Lua leaves the function. There is no standard way to access the values to be returned by the function. 14 | /// 15 | Return = 1, 16 | /// 17 | /// The line hook: is called when the interpreter is about to start the execution of a new line of code, or when it jumps back in the code (even to the same line). (This event only happens while Lua is executing a Lua function.) 18 | /// 19 | Line = 2, 20 | /// 21 | /// The count hook: is called after the interpreter executes every count instructions. (This event only happens while Lua is executing a Lua function.) 22 | /// 23 | Count = 3, 24 | /// 25 | /// Tail Call 26 | /// 27 | TailCall = 4, 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/LuaHookMask.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace KeraLua 4 | { 5 | /// 6 | /// Lua Hook Event Masks 7 | /// 8 | [Flags] 9 | public enum LuaHookMask 10 | { 11 | /// 12 | /// Disabled hook 13 | /// 14 | #pragma warning disable CA1008 // Enums should have zero value 15 | Disabled = 0, 16 | #pragma warning restore CA1008 // Enums should have zero value 17 | /// 18 | /// The call hook: is called when the interpreter calls a function. The hook is called just after Lua enters the new function, before the function gets its arguments. 19 | /// 20 | Call = 1 << LuaHookEvent.Call, 21 | /// 22 | /// The return hook: is called when the interpreter returns from a function. The hook is called just before Lua leaves the function. There is no standard way to access the values to be returned by the function. 23 | /// 24 | Return = 1 << LuaHookEvent.Return, 25 | /// 26 | /// The line hook: is called when the interpreter is about to start the execution of a new line of code, or when it jumps back in the code (even to the same line). (This event only happens while Lua is executing a Lua function.) 27 | /// 28 | Line = 1 << LuaHookEvent.Line, 29 | /// 30 | /// The count hook: is called after the interpreter executes every count instructions. (This event only happens while Lua is executing a Lua function.) 31 | /// 32 | Count = 1 << LuaHookEvent.Count, 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/LuaOperation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace KeraLua 6 | { 7 | /// 8 | /// Operation value used by Arith method 9 | /// 10 | public enum LuaOperation 11 | { 12 | /// 13 | /// adition(+) 14 | /// 15 | Add = 0, 16 | /// 17 | /// substraction (-) 18 | /// 19 | Sub = 1, 20 | /// 21 | /// Multiplication (*) 22 | /// 23 | Mul = 2, 24 | 25 | /// 26 | /// Modulo (%) 27 | /// 28 | Mod = 3, 29 | 30 | /// 31 | /// Exponentiation (^) 32 | /// 33 | Pow = 4, 34 | /// 35 | /// performs float division (/) 36 | /// 37 | Div = 5, 38 | /// 39 | /// performs floor division (//) 40 | /// 41 | Idiv = 6, 42 | /// 43 | /// performs bitwise AND 44 | /// 45 | Band = 7, 46 | /// 47 | /// performs bitwise OR (|) 48 | /// 49 | Bor = 8, 50 | /// 51 | /// performs bitwise exclusive OR (~) 52 | /// 53 | Bxor = 9, 54 | /// 55 | /// performs left shift 56 | /// 57 | Shl = 10, 58 | /// 59 | /// performs right shift 60 | /// 61 | Shr = 11, 62 | /// 63 | /// performs mathematical negation (unary -) 64 | /// 65 | Unm = 12, 66 | /// 67 | /// performs bitwise NOT (~) 68 | /// 69 | Bnot = 13, 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/LuaRegister.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace KeraLua 4 | { 5 | /// 6 | /// LuaRegister store the name and the delegate to register a native function 7 | /// 8 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 9 | public struct LuaRegister 10 | { 11 | /// 12 | /// Function name 13 | /// 14 | public string name; 15 | /// 16 | /// Function delegate 17 | /// 18 | [MarshalAs(UnmanagedType.FunctionPtr)] 19 | public LuaFunction function; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/LuaRegistry.cs: -------------------------------------------------------------------------------- 1 | namespace KeraLua 2 | { 3 | /// 4 | /// Enum for pseudo-index used by registry table 5 | /// 6 | #pragma warning disable CA1008 // Enums should have zero value 7 | public enum LuaRegistry 8 | #pragma warning restore CA1008 // Enums should have zero value 9 | { 10 | /* LUAI_MAXSTACK 1000000 */ 11 | /// 12 | /// pseudo-index used by registry table 13 | /// 14 | Index = -1000000 - 1000 15 | } 16 | 17 | /// 18 | /// Registry index 19 | /// 20 | #pragma warning disable CA1008 // Enums should have zero value 21 | public enum LuaRegistryIndex 22 | #pragma warning restore CA1008 // Enums should have zero value 23 | { 24 | /// 25 | /// At this index the registry has the main thread of the state. 26 | /// 27 | MainThread = 1, 28 | /// 29 | /// At this index the registry has the global environment. 30 | /// 31 | Globals = 2, 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/LuaStatus.cs: -------------------------------------------------------------------------------- 1 | namespace KeraLua 2 | { 3 | /// 4 | /// Lua Load/Call status return 5 | /// 6 | public enum LuaStatus 7 | { 8 | /// 9 | /// success 10 | /// 11 | OK = 0, 12 | /// 13 | /// Yield 14 | /// 15 | Yield = 1, 16 | /// 17 | /// a runtime error. 18 | /// 19 | ErrRun = 2, 20 | /// 21 | /// syntax error during precompilation 22 | /// 23 | ErrSyntax = 3, 24 | /// 25 | /// memory allocation error. For such errors, Lua does not call the message handler. 26 | /// 27 | ErrMem = 4, 28 | /// 29 | /// error while running the message handler. 30 | /// 31 | ErrErr = 5, 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/LuaType.cs: -------------------------------------------------------------------------------- 1 | namespace KeraLua 2 | { 3 | /// 4 | /// Lua types 5 | /// 6 | public enum LuaType 7 | { 8 | /// 9 | /// 10 | /// 11 | None = -1, 12 | /// 13 | /// LUA_TNIL 14 | /// 15 | Nil = 0, 16 | /// 17 | /// LUA_TBOOLEAN 18 | /// 19 | Boolean = 1, 20 | /// 21 | /// LUA_TLIGHTUSERDATA 22 | /// 23 | LightUserData = 2, 24 | /// 25 | /// LUA_TNUMBER 26 | /// 27 | Number = 3, 28 | /// 29 | /// LUA_TSTRING 30 | /// 31 | String = 4, 32 | /// 33 | /// LUA_TTABLE 34 | /// 35 | Table = 5, 36 | /// 37 | /// LUA_TFUNCTION 38 | /// 39 | Function = 6, 40 | /// 41 | /// LUA_TUSERDATA 42 | /// 43 | UserData = 7, 44 | /// 45 | /// LUA_TTHREAD 46 | /// 47 | /// // 48 | Thread = 8, 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Names.txt: -------------------------------------------------------------------------------- 1 | luaL_addlstring 2 | luaL_addstring 3 | luaL_addvalue 4 | luaL_argerror 5 | luaL_buffinit 6 | luaL_buffinitsize 7 | luaL_callmeta 8 | luaL_checkany 9 | luaL_checkinteger 10 | luaL_checklstring 11 | luaL_checknumber 12 | luaL_checkoption 13 | luaL_checkstack 14 | luaL_checktype 15 | luaL_checkudata 16 | luaL_checkversion_ 17 | luaL_error 18 | luaL_execresult 19 | luaL_fileresult 20 | luaL_getmetafield 21 | luaL_getsubtable 22 | luaL_gsub 23 | luaL_len 24 | luaL_loadbufferx 25 | luaL_loadfilex 26 | luaL_loadstring 27 | luaL_newmetatable 28 | luaL_newstate 29 | luaL_openlibs 30 | luaL_optinteger 31 | luaL_optlstring 32 | luaL_optnumber 33 | luaL_prepbuffsize 34 | luaL_pushresult 35 | luaL_pushresultsize 36 | luaL_ref 37 | luaL_requiref 38 | luaL_setfunlcs 39 | luaL_setmetatable 40 | luaL_testudata 41 | luaL_tolstring 42 | luaL_traceback 43 | luaL_unref 44 | luaL_where 45 | lua_absindex 46 | lua_arith 47 | lua_atpanic 48 | lua_callk 49 | lua_checkstack 50 | lua_close 51 | lua_compare 52 | lua_concat 53 | lua_copy 54 | lua_createtable 55 | lua_dump 56 | lua_error 57 | lua_gc 58 | lua_getallocf 59 | lua_getfield 60 | lua_getglobal 61 | lua_gethook 62 | lua_gethookcount 63 | lua_gethookmask 64 | lua_geti 65 | lua_getinfo 66 | lua_getlocal 67 | lua_getmetatable 68 | lua_getstack 69 | lua_gettable 70 | lua_gettop 71 | lua_getupvalue 72 | lua_getuservalue 73 | lua_iscfunction 74 | lua_isinteger 75 | lua_isnumber 76 | lua_isstring 77 | lua_isuserdata 78 | lua_isyieldable 79 | lua_len 80 | lua_load 81 | lua_newstate 82 | lua_newthread 83 | lua_newuserdata 84 | lua_next 85 | lua_pcallk 86 | lua_pushboolean 87 | lua_pushcclosure 88 | lua_pushfstring 89 | lua_pushinteger 90 | lua_pushlightuserdata 91 | lua_pushlstring 92 | lua_pushnil 93 | lua_pushnumber 94 | lua_pushstring 95 | lua_pushthread 96 | lua_pushvalue 97 | lua_pushvfstring 98 | lua_rawequal 99 | lua_rawget 100 | lua_rawgeti 101 | lua_rawgetp 102 | lua_rawlen 103 | lua_rawset 104 | lua_rawseti 105 | lua_rawsetp 106 | lua_resume 107 | lua_rotate 108 | lua_setallocf 109 | lua_setfield 110 | lua_setglobal 111 | lua_sethook 112 | lua_seti 113 | lua_setlocal 114 | lua_setmetatable 115 | lua_settable 116 | lua_settop 117 | lua_setupvalue 118 | lua_setuservalue 119 | lua_status 120 | lua_stringtonumber 121 | lua_toboolean 122 | lua_tocfunction 123 | lua_tointegerx 124 | lua_tolstring 125 | lua_tonumberx 126 | lua_topointer 127 | lua_tothread 128 | lua_touserdata 129 | lua_type 130 | lua_typename 131 | lua_upvalueid 132 | lua_upvaluejoin 133 | lua_version 134 | lua_xmove 135 | lua_yieldk 136 | 137 | -------------------------------------------------------------------------------- /src/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | #if __MACOS__ || __TVOS__ || __WATCHOS__ || __IOS__ 4 | 5 | using Foundation; 6 | 7 | #if NET 8 | [assembly: AssemblyMetadata ("IsTrimmable", "True")] 9 | #else 10 | [assembly: LinkerSafe] 11 | #endif 12 | 13 | #endif 14 | 15 | // Information about this assembly is defined by the following attributes. 16 | // Change them to the values specific to your project. 17 | 18 | #if NETFRAMEWORK 19 | [assembly: AssemblyTitle ("KeraLua (.NET Framework 4.6)")] 20 | #elif WINDOWS_UWP 21 | [assembly: AssemblyTitle ("KeraLua (Windows Universal)")] 22 | #elif __ANDROID__ 23 | [assembly: AssemblyTitle ("KeraLua (Android)")] 24 | #elif NETCOREAPP 25 | [assembly: AssemblyTitle("KeraLua (.NET Core)")] 26 | #elif NETSTANDARD 27 | [assembly: AssemblyTitle ("KeraLua (.NET Standard)")] 28 | #elif __TVOS__ 29 | [assembly: AssemblyTitle ("KeraLua (tvOS)")] 30 | #elif __WATCHOS__ 31 | [assembly: AssemblyTitle ("KeraLua (watchOS)")] 32 | #elif __IOS__ 33 | [assembly: AssemblyTitle ("KeraLua (iOS)")] 34 | #elif __MACOS__ 35 | [assembly: AssemblyTitle ("KeraLua (Mac)")] 36 | #else 37 | #error "Unknow platform build" 38 | #endif 39 | 40 | [assembly: AssemblyDescription("Binding library for native Lua")] 41 | [assembly: AssemblyCompany("NLua")] 42 | [assembly: AssemblyProduct("KeraLua")] 43 | [assembly: AssemblyCopyright("Copyright © Vinicius Jarina 2025")] 44 | [assembly: AssemblyCulture("")] 45 | 46 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 47 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 48 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 49 | 50 | [assembly: AssemblyVersion("1.0.16.0")] 51 | [assembly: AssemblyInformationalVersion("1.0.16+Branch.main.Sha.36a5ab85f9b3be028d4885b0f0d45cc3b2cc854f")] 52 | [assembly: AssemblyFileVersion("1.0.16.0")] 53 | 54 | -------------------------------------------------------------------------------- /tests/LuaTests/core/bisect.lua: -------------------------------------------------------------------------------- 1 | -- bisection method for solving non-linear equations 2 | 3 | delta=1e-6 -- tolerance 4 | 5 | function bisect(f,a,b,fa,fb) 6 | local c=(a+b)/2 7 | print(n .. " c=" .. c .. " a=" .. a .. " b=" .. b .. "\n") 8 | if c==a or c==b or math.abs(a-b)= 0 then 76 | return math.floor(num+.5) 77 | else 78 | return math.ceil(num-.5) 79 | end 80 | end 81 | 82 | for c0=-20,50-1,10 do 83 | io.write("C ") 84 | for c=c0,c0+10-1 do 85 | io.write(string.format("%3.0f ",c)) 86 | end 87 | io.write("\n") 88 | 89 | io.write("F ") 90 | for c=c0,c0+10-1 do 91 | f=(9/5)*c+32 92 | x = round(f) 93 | celcius = cf [x] 94 | assert (celcius == c) 95 | io.write(string.format("%3.0f ",f)) 96 | end 97 | 98 | io.write("\n\n") 99 | end 100 | -------------------------------------------------------------------------------- /tests/LuaTests/core/factorial.lua: -------------------------------------------------------------------------------- 1 | -- function closures are powerful 2 | local fact = {} 3 | fact[0] = 1 4 | fact[1] = 1 5 | fact[2] = 2 6 | fact[3] = 6 7 | fact[4] = 24 8 | fact[5] = 120 9 | fact[6] = 720 10 | fact[7] = 5040 11 | fact[8] = 40320 12 | fact[9] = 362880 13 | fact[10] = 3628800 14 | fact[11] = 39916800 15 | fact[12] = 479001600 16 | fact[13] = 6227020800 17 | fact[14] = 87178291200 18 | fact[15] = 1307674368000 19 | fact[16] = 20922789888000 20 | 21 | -- traditional fixed-point operator from functional programming 22 | Y = function (g) 23 | local a = function (f) return f(f) end 24 | return a(function (f) 25 | return g(function (x) 26 | local c=f(f) 27 | return c(x) 28 | end) 29 | end) 30 | end 31 | 32 | 33 | -- factorial without recursion 34 | F = function (f) 35 | return function (n) 36 | if n == 0 then return 1 37 | else return n*f(n-1) end 38 | end 39 | end 40 | 41 | factorial = Y(F) -- factorial is the fixed point of F 42 | 43 | -- now test it 44 | function test(x) 45 | local val = factorial(x) 46 | print(x.." ".."! = ".." ".. val.." ".."\n") 47 | return val 48 | end 49 | 50 | for n=0,16 do 51 | local val = test (n) 52 | assert (val == fact [n]) 53 | end 54 | -------------------------------------------------------------------------------- /tests/LuaTests/core/fib.lua: -------------------------------------------------------------------------------- 1 | -- fibonacci function with cache 2 | 3 | -- very inefficient fibonacci function 4 | function fib(n) 5 | N=N+1 6 | if n<2 then 7 | return n 8 | else 9 | return fib(n-1)+fib(n-2) 10 | end 11 | end 12 | 13 | -- a general-purpose value cache 14 | function cache(f) 15 | local c={} 16 | return function (x) 17 | local y=c[x] 18 | if not y then 19 | y=f(x) 20 | c[x]=y 21 | end 22 | return y 23 | end 24 | end 25 | 26 | -- run and time it 27 | function test(s,f) 28 | N=0 29 | local c=os.clock() 30 | local v=f(n) 31 | local t=os.clock()-c 32 | print(s,n,v,t,N) 33 | return v 34 | end 35 | 36 | n= 24 -- for other values, do lua fib.lua XX 37 | n=tonumber(n) 38 | print("","n","value","time","evals") 39 | v = test("plain",fib) 40 | assert (v == 46368) 41 | 42 | fib=cache(fib) 43 | v = test("cached",fib) 44 | 45 | assert (v == 46368) 46 | -------------------------------------------------------------------------------- /tests/LuaTests/core/fibfor.lua: -------------------------------------------------------------------------------- 1 | -- example of for with generator functions 2 | 3 | 4 | local fibs = { 5 | 1, 6 | 1, 7 | 2, 8 | 3, 9 | 5, 10 | 8, 11 | 13, 12 | 21, 13 | 34, 14 | 55, 15 | 89, 16 | 144, 17 | 233, 18 | 377, 19 | 610, 20 | 987, 21 | } 22 | 23 | 24 | function generatefib (n) 25 | return coroutine.wrap(function () 26 | local a,b = 1, 1 27 | while a <= n do 28 | coroutine.yield(a) 29 | a, b = b, a+b 30 | end 31 | end) 32 | end 33 | local j = 1 34 | for i in generatefib(1000) do 35 | print(i.." ".. fibs [j]) 36 | assert (i == fibs [j]) 37 | j = j + 1 38 | end 39 | -------------------------------------------------------------------------------- /tests/LuaTests/core/life.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NLua/KeraLua/e9d2f63e11e47a5a73d9f15243547ca722cca0a4/tests/LuaTests/core/life.lua -------------------------------------------------------------------------------- /tests/LuaTests/core/printf.lua: -------------------------------------------------------------------------------- 1 | -- an implementation of printf 2 | 3 | function sprintf(...) 4 | return string.format(...) 5 | end 6 | 7 | function printf (...) 8 | print(sprintf(...)) 9 | end 10 | 11 | x = sprintf("Hello %s from %s on %s", "there", "Lua Tests", "XYZ") 12 | assert (x == "Hello there from Lua Tests on XYZ") 13 | print(x) 14 | -------------------------------------------------------------------------------- /tests/LuaTests/core/sieve.lua: -------------------------------------------------------------------------------- 1 | -- the sieve of of Eratosthenes programmed with coroutines 2 | -- typical usage: lua -e N=1000 sieve.lua | column 3 | 4 | local siev = { 5 | 2, 6 | 3, 7 | 5, 8 | 7, 9 | 11, 10 | 13, 11 | 17, 12 | 19, 13 | 23, 14 | 29, 15 | 31, 16 | 37, 17 | 41, 18 | 43, 19 | 47, 20 | 53, 21 | 59, 22 | 61, 23 | 67, 24 | 71, 25 | 73, 26 | 79, 27 | 83, 28 | 89, 29 | 97, 30 | 101, 31 | 103, 32 | 107, 33 | 109, 34 | 113, 35 | 127, 36 | 131, 37 | 137, 38 | 139, 39 | 149, 40 | 151, 41 | 157, 42 | 163, 43 | 167, 44 | 173, 45 | 179, 46 | 181, 47 | 191, 48 | 193, 49 | 197, 50 | 199, 51 | 211, 52 | 223, 53 | 227, 54 | 229, 55 | 233, 56 | 239, 57 | 241, 58 | 251, 59 | 257, 60 | 263, 61 | 269, 62 | 271, 63 | 277, 64 | 281, 65 | 283, 66 | 293, 67 | 307, 68 | 311, 69 | 313, 70 | 317, 71 | 331, 72 | 337, 73 | 347, 74 | 349, 75 | 353, 76 | 359, 77 | 367, 78 | 373, 79 | 379, 80 | 383, 81 | 389, 82 | 397, 83 | 401, 84 | 409, 85 | 419, 86 | 421, 87 | 431, 88 | 433, 89 | 439, 90 | 443, 91 | 449, 92 | 457, 93 | 461, 94 | 463, 95 | 467, 96 | 479, 97 | 487, 98 | 491, 99 | 499, 100 | 503, 101 | 509, 102 | 521, 103 | 523, 104 | 541, 105 | 547, 106 | 557, 107 | 563, 108 | 569, 109 | 571, 110 | 577, 111 | 587, 112 | 593, 113 | 599, 114 | 601, 115 | 607, 116 | 613, 117 | 617, 118 | 619, 119 | 631, 120 | 641, 121 | 643, 122 | 647, 123 | 653, 124 | 659, 125 | 661, 126 | 673, 127 | 677, 128 | 683, 129 | 691, 130 | 701, 131 | 709, 132 | 719, 133 | 727, 134 | 733, 135 | 739, 136 | 743, 137 | 751, 138 | 757, 139 | 761, 140 | 769, 141 | 773, 142 | 787, 143 | 797, 144 | 809, 145 | 811, 146 | 821, 147 | 823, 148 | 827, 149 | 829, 150 | 839, 151 | 853, 152 | 857, 153 | 859, 154 | 863, 155 | 877, 156 | 881, 157 | 883, 158 | 887, 159 | 907, 160 | 911, 161 | 919, 162 | 929, 163 | 937, 164 | 941, 165 | 947, 166 | 953, 167 | 967, 168 | 971, 169 | 977, 170 | 983, 171 | 991, 172 | 997, 173 | } 174 | -- generate all the numbers from 2 to n 175 | function gen (n) 176 | return coroutine.wrap(function () 177 | for i=2,n do coroutine.yield(i) end 178 | end) 179 | end 180 | 181 | -- filter the numbers generated by `g', removing multiples of `p' 182 | function filter (p, g) 183 | return coroutine.wrap(function () 184 | while 1 do 185 | local n = g() 186 | if n == nil then return end 187 | if math.fmod(n, p) ~= 0 then coroutine.yield(n) end 188 | end 189 | end) 190 | end 191 | 192 | N=1000 -- from command line 193 | x = gen(N) -- generate primes up to N 194 | local j = 1 195 | while 1 do 196 | local n = x() -- pick a number until done 197 | if n == nil then break end 198 | print(n) -- must be a prime number 199 | assert (n == siev [j]) 200 | x = filter(n, x) -- now remove its multiples 201 | j = j + 1 202 | end 203 | -------------------------------------------------------------------------------- /tests/LuaTests/core/sort.lua: -------------------------------------------------------------------------------- 1 | -- two implementations of a sort function 2 | -- this is an example only. Lua has now a built-in function "sort" 3 | 4 | quicksort_x = {"Apr","Aug","Dec","Feb","Jan","Jul","Jun","Mar","May","Nov","Oct","Sep"} 5 | reverse_x = {"Sep","Oct","Nov","May","Mar","Jun","Jul","Jan","Feb","Dec","Aug","Apr"} 6 | 7 | -- extracted from Programming Pearls, page 110 8 | function qsort(x,l,u,f) 9 | if ly end) 62 | show("after reverse selection sort",x, reverse_x) 63 | qsort(x,1,n,function (x,y) return x 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {20AE709C-FB97-48E3-89B0-A34A5C3DA1DB} 8 | Library 9 | Properties 10 | KeraLuaTest 11 | KeraLuaTest 12 | v4.6 13 | 512 14 | 15 | 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | true 27 | AnyCPU 28 | 29 | 30 | pdbonly 31 | true 32 | bin\Release\ 33 | TRACE 34 | prompt 35 | 4 36 | true 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | PreserveNewest 53 | LuaTests\core\bisect.lua 54 | 55 | 56 | PreserveNewest 57 | LuaTests\core\cf.lua 58 | 59 | 60 | PreserveNewest 61 | LuaTests\core\factorial.lua 62 | 63 | 64 | PreserveNewest 65 | LuaTests\core\fib.lua 66 | 67 | 68 | PreserveNewest 69 | LuaTests\core\fibfor.lua 70 | 71 | 72 | PreserveNewest 73 | LuaTests\core\life.lua 74 | 75 | 76 | PreserveNewest 77 | LuaTests\core\printf.lua 78 | 79 | 80 | PreserveNewest 81 | LuaTests\core\sieve.lua 82 | 83 | 84 | PreserveNewest 85 | LuaTests\core\sort.lua 86 | 87 | 88 | foo.lua 89 | PreserveNewest 90 | 91 | 92 | main.lua 93 | PreserveNewest 94 | 95 | 96 | module1.lua 97 | PreserveNewest 98 | 99 | 100 | 101 | 102 | lua54.dll 103 | PreserveNewest 104 | 105 | 106 | liblua54.dylib 107 | PreserveNewest 108 | 109 | 110 | liblua54.so 111 | PreserveNewest 112 | 113 | 114 | 115 | 116 | {c45805a8-6436-4738-bd9f-4632eea63bbc} 117 | KeraLua 118 | 119 | 120 | 121 | 122 | 3.14.0 123 | 124 | 125 | 4.6.0 126 | runtime; build; native; contentfiles; analyzers; buildtransitive 127 | all 128 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /tests/build/net9.0/KeraLuaTest.net9.0.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0 4 | false 5 | false 6 | false 7 | false 8 | false 9 | false 10 | false 11 | false 12 | false 13 | false 14 | false 15 | Release;Debug 16 | 17 | 18 | 19 | bin\Release\ 20 | false 21 | 22 | 23 | 24 | bin\Debug\ 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | PreserveNewest 40 | 41 | 42 | PreserveNewest 43 | 44 | 45 | PreserveNewest 46 | 47 | 48 | PreserveNewest 49 | 50 | 51 | PreserveNewest 52 | 53 | 54 | PreserveNewest 55 | 56 | 57 | PreserveNewest 58 | 59 | 60 | PreserveNewest 61 | 62 | 63 | PreserveNewest 64 | 65 | 66 | foo.lua 67 | PreserveNewest 68 | 69 | 70 | main.lua 71 | PreserveNewest 72 | 73 | 74 | module1.lua 75 | PreserveNewest 76 | 77 | 78 | 79 | 80 | lua54.dll 81 | PreserveNewest 82 | 83 | 84 | liblua54.dylib 85 | PreserveNewest 86 | 87 | 88 | liblua54.so 89 | PreserveNewest 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | --------------------------------------------------------------------------------