/
niceSOFT
/
swig
Обзор
Документация
Войти
/
niceSOFT
/
swig
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Examples/test-suite/lua/director_primitives_runme.lua
54 строки
2 KB
Erez Geva
Rename the near function to cmp_flt function that compare float numbers (#3490)
09 июл 2026, 20:27
Не верифицирован
09 июл 2026, 20:27
d43ee44
Код
Авторство
О чём код?
require("director_primitives") function makeCalls(myCaller, myBase) myCaller:set(myBase) myCaller:NoParmsMethodCall() assert(myCaller:BoolMethodCall(true)) assert(not myCaller:BoolMethodCall(false )) assert(myCaller:IntMethodCall(-123) == -123) assert(myCaller:UIntMethodCall(123) == 123) assert(cmp_flt(myCaller:FloatMethodCall(-123 / 128), -0.9609375)) assert(myCaller:CharPtrMethodCall("test string") == "test string") assert(myCaller:ConstCharPtrMethodCall("another string") == "another string") assert(myCaller:EnumMethodCall(director_primitives.HShadowHard) == director_primitives.HShadowHard) myCaller:ManyParmsMethodCall(true, -123, 123, 123.456, "test string", "another string", director_primitives.HShadowHard) myCaller:NotOverriddenMethodCall() myCaller:reset() end local myCaller = director_primitives.Caller() local myBase1 = director_primitives.Base(100.0) makeCalls(myCaller, myBase1) local myBase2 = director_primitives.Derived(200.0) makeCalls(myCaller, myBase2) local myBase3 = director_primitives.Base(300.0) swig_derive(myBase3, { NoParmsMethod = function(self) end, BoolMethod = function(self, x) return x end, IntMethod = function(self, x) return x end, UIntMethod = function(self, x) return x end, FloatMethod = function(self, x) return x end, CharPtrMethod = function(self, x) return x end, ConstCharPtrMethod = function(self, x) return x end, EnumMethod = function(self, x) return x end, ManyParmsMethod = function(self) end}) makeCalls(myCaller, myBase3)